Generation

generate functionSun, 09 Apr 2023

#Use gregexpr() to obtain a list called "atsign", which shows the starting positions and length of the usernames associated with the "@" symbol in the "text" column. #Review the "atsign" list and identify the smallest row number that contains "@" symbols with a length greater than 2 and tell me the row number. #Using a loop, extract the usernames associated with the "@" symbol in the "text" column of "notrt_trump" for the row you identified in Question 6.

notrt_trump$text <- as.character(notrt_trump$text) atsign <- gregexpr("@",notrt_trump$text) smallest <- which.min(attr(atsign,"match.length")) names <- strsplit(notrt_trump$text[smallest],"@")[[1]][2]

Questions about programming?Chat with your personal AI assistant