Reputation: 115
I'm having some trouble with R and the twitteR-package.
My aim is to get the total tweet from a given user. The user-class offers a statusesCount-field. I don't know how to get the value from this field.
The vignette only offers examples with tweets from public timelines and even there I can't get the total counts.
The example in the vignette looks like this (p. 5):
sapply(publicTimeline(), function(x) x$getStatusSource())
I can extract even the ScreenName or the user-ID:
sapply(publicTimeline(), function(x) x$getScreenName())
sapply(publicTimeline(), function(x) x$getID())
In fact, the publicTimeline-function catches random users and I'd like to have given users.
Anyone can help me?
Regards,
Arne
Upvotes: 2
Views: 1924
Reputation: 2624
You'll want to first getUser
for a specific user. Then, you can use str()
to understand the structure of that user. The @
symbol is used to access fields in S4 objects.
Example:
> library(twitteR)
> user <- getUser("@twitter")
> user@statusesCount
[1] 1087
Upvotes: 4