【问题标题】:How to get more data with twitteR timeline如何使用 twitteR 时间线获取更多数据
【发布时间】:2017-01-13 07:47:15
【问题描述】:

我需要导出 100 个用户的推特时间线,我需要 2014 年的所有推文。 我第一次使用 R,我能够运行时间线函数并检索单个用户的所有最后 N 条推文。问题是我需要更多的数据,比如时间戳、转发次数、favs ecc 的数量。 我该怎么做? 我使用的函数是:

userTimeline('username', n=200, maxID=NULL, sinceID=NULL, includeRts=TRUE)

【问题讨论】:

    标签: r twitter


    【解决方案1】:

    或者,其他方式是

    获取包含所有信息的@HillaryClinton 推文。最高可达 3200

    clinton_tweets <- userTimeline("HillaryClinton", n = 3200)
    

    将 twitteR 列表转换为 data.frames 的函数

    tweetsc.df <- twListToDF(clinton_tweets)
    

    然后只需打开 tweetsc.df 并查看所有结果

    【讨论】:

      【解决方案2】:

      一切都在那里:

      library(twitteR)
      # ... authorize ...
      tl <- userTimeline('lukeanker', n=6)
      df <- do.call(rbind, lapply(tl, function(x) x$toDataFrame()))
      names(df)
      # [1] "text"          "favorited"     "favoriteCount" "replyToSN"     "created"       "truncated"     "replyToSID"   
      # [8] "id"            "replyToUID"    "statusSource"  "screenName"    "retweetCount"  "isRetweet"     "retweeted"    
      # [15] "longitude"     "latitude"
      
      df[, c("created", "retweetCount")]
      #               created retweetCount
      # 1 2015-03-05 13:50:44            0
      # 2 2015-02-19 15:51:47            0
      # 3 2015-02-17 17:36:01            0
      # 4 2015-02-17 17:35:03            0
      # 5 2015-02-12 16:49:29            0
      # 6 2015-02-11 10:29:35            0
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-04-16
        • 1970-01-01
        • 2014-09-30
        • 1970-01-01
        • 2011-11-11
        • 2015-10-19
        • 2013-07-18
        • 2014-02-18
        相关资源
        最近更新 更多