r - How to sort tweets returned by batch status ID in order as submitted by twitteR -


i have list of on 16k tweet id's of obtain text. using twitter , 2 functions from reply reproducing here:

library(twitter) library(roauth) library(httr)  lookupstatus <- function (ids, ...){   lapply(ids, twitter:::check_id)   batches <- split(ids, ceiling(seq_along(ids)/100))    results <- lapply(batches, function(batch) {     params <- parseids(batch)     statuses <- twitter:::twinterfaceobj$doapicall(paste("statuses", "lookup", sep = "/"), params = params, ...)     twitter:::import_statuses(statuses)    })    return(unlist(results)) # not return tweets in order submitted }   parseids <- function(ids){   id_list <- list()   if (length(ids) > 0) {     id_list$id <- paste(ids, collapse = ",")   }   return(id_list) }  api_key <- consumer_key api_secret <- consumer_secret access_token <- oauth_token access_token_secret <- oauth_token_secret setup_twitter_oauth(api_key, api_secret, access_token, access_token_secret)  tweetcsv <- data.frame(as.character(c(597576902212063232, 65586175864610817,  563881580209246209, 595380689534656512, 563757610327748608,  563082741370339330, 596962098845851648, 563874350038675457,  597240424873394176, 571030421103910912))) colnames(tweetcsv) <- c("tweetid")  activeids <- lookupstatus(tweetcsv$tweetid) 

this returning list can access each element using activeids$'11' (i cannot understand why has happened). can access each element's sub-elements using activeids$'11'$ there ton of features choose such created, favoritecount, favorited, id, isretweet, text, id, etc. there more 70 of these fields.

what have api return tweet's text in same order id submitted in original data have 4 columns first 1 being tweet id whilst rest human decided tweet be, 0ffenisve, sexism etc. order of returned tweet text important can insert text in dataset. data have hate speec twitter annotations dataset. great if text , id api save few calls probably. appreciated. thanks.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -