So im actually working on twitteR and i need a way to store my tweets into a csv file and pull it out when i need it . This is due to the idea i want to compile the tweets i
Not tested, but from what I've read online, it seems like the following should work:
Convert the list
to a data.frame
library(plyr)
tweets.df = ldply(tweets, function(t) t$toDataFrame())
Use write.csv
as before, but just on the tweets.df
object instead of the tweets
object.
write.csv(tweets.df, file = "newfile.csv")
Sources: Here and here. See also: ?"status-class"
.
You can use the following to convert tweets into tweets dataframe:
tweets.df <- do.call("rbind", lapply(tweets, as.data.frame))
Then use tweets.df in your write.csv function.
using twitteR package:
convert your tweets to data frame
tweets2df <- twListToDF(tweets)
then save it to csv
write.csv(tweets2df, file = "tweets.csv")