0

I am trying to use the rtweet package but get the following message when trying to use the search_tweets() function like so:

x <- search_tweets(q="football", n=100)
Searching for tweets...
Collected  tweets!
Error: data is not a data frame

I couldn't find a lot of instruction on how to use the basic functions of the package, so maybe am I missing an intermediate step in between setting up the app token and grabbing tweets?

demongolem
  • 9,474
  • 36
  • 90
  • 105
moman822
  • 1,904
  • 3
  • 19
  • 33
  • There is no more. I've only otherwise established the token with `create_token()` which seems to have worked. – moman822 Sep 12 '16 at 01:22
  • If you created the token, did you save the path as an environment variable? If not, either follow the instructions here (https://github.com/mkearney/rtweet/blob/master/vignettes/tokens.Rmd) or specify the token using the token argument (e.g., search_tweets("football", token = twitter_token) – mkearney Sep 12 '16 at 06:26

2 Answers2

0

I'd currently recommend installing the development version on Github (https://github.com/mkearney/rtweet). Without seeing your session info and script, I wouldn't be able to tell you exactly what the problem is. My guess is something went wrong with your API token/oauth (see the Github link for token instructions) or you're missing a dependency. If it's the latter, you could make sure you have "dplyr" installed, but you're better off with the Github version anyway, which only has a few dependencies.

If that doesn't fix the problem, I'd be curious to know what's going on. The transition from twitteR to rtweet has sped bings up a bit, but the next CRAN release should include a few more functions and a lot more documentation and useful error messages. Until then, feel free to post any issues to Github (I'll try to check on here, too, but it probably won't be as frequent).

mkearney
  • 1,266
  • 10
  • 18
  • I can give the github version a shot. I did try twitteR with the same API keys, etc, and was able to get some tweets with `search_Twitter()`. I'll try the github version this evening and report or put add an issue there if it doesn't resolve the problem. – moman822 Sep 12 '16 at 11:56
0

I would suggest trying x <- rtweet::search_tweets(q="football", n=100), resulting in:

>dim(x)
[1] 98 35

Additionally:

>class(x)
[1] "data.frame"
amonk
  • 1,769
  • 2
  • 18
  • 27