r - Looping through names in a csv file -


i trying loop through names in csv file following loop retrieve twitter data:

require(twitter) require(data.table)  consumer_key <- 'key' consumer_secret <- 'con_secret' access_token <-  'token' access_secret <- 'acc_secret'  setup_twitter_oauth(consumer_key,consumer_secret,access_token,access_secret)  options(httr_oauth_cache=t)   accounts <- read.csv(file="file.csv", header=false, sep="") 

sample data in csv file (each name in 1 1 row, first column):  timberghmans alyssabereznak joshualenon 

names <- lookupusers(c(accounts)) for(name in names){     <- getuser(name)     print(a)     b <- a$getfollowers()     print(b)     b_df <- rbindlist(lapply(b, as.data.frame))     print(b_df)     c <- subset(b_df, location!="")     d <- c$location     print(d)   } 

however, not work. every new row contains twitter screenname.when type in this:

names <- lookupusers(c("user1","user2","user3")) 

it works perfectly. tried loop through accounts, no avail. maybe have general example, or give hint please?


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -