moman822
moman822

Reputation: 1954

rtweet error message "data is not a data frame"

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?

Upvotes: 0

Views: 462

Answers (2)

amonk
amonk

Reputation: 1795

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"

Upvotes: 0

mkearney
mkearney

Reputation: 1335

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).

Upvotes: 0

Related Questions