如何从Twitter获取特定的字符串或记录

时间:2015-06-02 01:31:53

标签: r api twitter stream

names(st)<-c("id_str", "created_at", "text", "location")

parseTweets(filterStream(file.name= "", track=c("climate change"), timeout=10, oauth=twitCred))$st

# [1]   6113    214   3649   1444   4483    270   8022  41946 494038   8925   3454   5249  20517  14790  14276  15316 583259   4254   3962   6635  52878   3669   2230   6186   9348 583267
#[27]  46894  17360  18038   3764

我不想看到这些数字。我想看看实际的推文。例如

id_str             created_at                    text    location
   xxx    Mon Jun 01 16:52:33  ABCDEFG climate change          UK
  xxx1    Mon Jun 01 16:52:33   XYZCDF climate change   Australia
  xxxB    Mon Jun 01 16:52:34   climate change XYZCDF         USA

1 个答案:

答案 0 :(得分:0)

请在发布问题之前查看?parseTweets底部的示例。

此行中的对象st

names(st)<-c("id_str", "created_at", "text", "location")

st电话结束时的parseTweets无关。您正在使用$运算符,因此它通过搜索$statuses_count来完成字符串,st也以$st开头

删除parseTweets命令末尾的$text,您会看到实际上想要{{1}}列。

相关问题