Learn R Programming

twitterreport (version 0.15.11)

tw_api_get_statuses_user_timeline: Gets status updates (tweets) from a given user

Description

Using the twitter API, gets the status updates of a given user (up to 3,200)

Usage

tw_api_get_statuses_user_timeline(screen_name = NULL, twitter_token, user_id = NULL, since_id = NULL, count = 100, max_id = NULL, exclude_replies = NULL, include_rts = NULL, quietly = FALSE, ...)

Arguments

screen_name
of the user
twitter_token
Token
user_id
The ID of the user for whom to return results for
since_id
Returns results with an ID greater than (that is, more recent than) the specified ID
count
Number of statuses to get
max_id
Returns results with an ID less than (that is, older than) or equal to the specified ID
exclude_replies
This parameter will prevent replies from appearing in the returned timeline
include_rts
When set to false, the timeline will strip any native retweets
quietly
Whether or not to show the 'success' message
...
Additional arguments passed to GET

Value

A data.frame with tweets (if success), with the following columns:
  • screen_name
  • in_reply_to_screen_name
  • user_id
  • created_at
  • id
  • text
  • source
  • truncated
  • retweet_count
  • favourites_count
  • favorited
  • retweeted
  • coordinates
  • source_name
otherwise returns NULL.

Details

This function is designed to be applied to a large list of twitter accounts, see the example below. From twitterReturns a collection of the most recent Tweets posted by the user indicated by the screen_name or user_id parameters.

References

Twitter REST API (GET statuses/user_timeline) https://dev.twitter.com/rest/reference/get/statuses/user_timeline

See Also

tw_extract

Other API functions: tw_api_get_followers_ids, tw_api_get_followers_list, tw_api_get_friends_ids, tw_api_get_search_tweets, tw_api_get_statuses_sample, tw_api_get_trends_place, tw_api_get_users_search, tw_api_get_users_show, tw_api_trends_available, tw_gen_token

Examples

Run this code
## Not run: 
# # List of twitter accounts
# users <- c('MarsRovers', 'senatormenendez', 'sciencemagazine')
# 
# # Getting the twitts (first gen the token)
# key <- tw_gen_token('myapp','key', 'secret')
# tweets <- lapply(users, tw_api_get_statuses_user_timeline, twitter_token=key)
# 
# # Processing the data (and taking a look)
# tweets <- do.call(rbind, tweets)
# head(tweets)
# ## End(Not run)

Run the code above in your browser using DataLab