I am still learning R and am trying to create a database of twitters of political representatives using rtweet. I have a dataframe with the Twitter handles of hundreds of such representatives, the region they represent and their political affiliation.
tweets <- data.frame(Person = c("A", "B", "C"), 
                     Handle = c("@RepA", "@RepB", "@RepC"),
                      Party = c("AA", "CO", "BJ"), 
                     Region = c("P", "D", "R"))
I want to create a separate dataframe of each person's twitter account which includes their respective parties and regions. So far, I have done it manually using the following code:
repA        <- get_timelines('RepA', n=3200, lang="en")
repA$party  <- "AA"
repA$region <- "P"
repB        <- get_timelines('RepB', n=3200, lang="en")
repB$party  <- "CO"
repB$region <- "D"
repC        <- get_timelines('RepC', n=3200, lang="en")
repC$party  <- "BJ"
repC$region <- "R"
But I have at least 500 entries in the original dataframe and would like to automate this process. There must be a cleaner way to do this?
 
    