R: How to save lists into csv?

前端 未结 3 1158
野趣味
野趣味 2020-12-05 12:01

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

3条回答
  •  难免孤独
    2020-12-05 12:25

    Not tested, but from what I've read online, it seems like the following should work:

    1. Convert the list to a data.frame

      library(plyr) 
      tweets.df = ldply(tweets, function(t) t$toDataFrame())
      
    2. 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".

提交回复
热议问题