rtweet (version 0.3.7)

get_timeline: get_timeline

Description

Returns timeline of tweets from a specified Twitter user.

Usage

get_timeline(user, n = 200, max_id = NULL, parse = TRUE, clean_tweets = FALSE, as_double = FALSE, token = NULL, ...)

Arguments

user
Screen name or user id of target user.
n
Numeric, number of tweets to return.
max_id
Character, status_id from which returned tweets should be older than
parse
Logical, indicating whether to return parsed (data.frames) or nested list (fromJSON) object. By default, parse = TRUE saves users from the time [and frustrations] associated with disentangling the Twitter API return objects.
clean_tweets
logical indicating whether to remove non-ASCII characters in text of tweets. defaults to FALSE.
as_double
logical indicating whether to handle ID variables as double (numeric) class. By default, this is set to FALSE, meaning ID variables are treated as character vectors. Setting this to TRUE can provide performance (speed and memory) boost but can also lead to issues when printing and saving, depending on the format.
token
OAuth token. By default token = NULL fetches a non-exhausted token from an environment variable. Find instructions on how to create tokens and setup an environment variable in the tokens vignette (in r, send ?tokens to console).
...
Futher arguments passed on to make_url. All named arguments that do not match the above arguments (i.e., count, type, etc.) will be built into the request. To return only English language tweets, for example, use lang = "en". Or, to exclude retweets, use include_rts = FALSE. For more options see Twitter's API documentation.

Value

List consisting of two data frames. One with the tweets data for a specified user and the second is a single row for the user provided.

See Also

https://dev.twitter.com/overview/documentation

Other tweets: get_favorites, lookup_statuses, search_tweets, stream_tweets, tweets_data

Examples

Run this code
## Not run: 
# # get 2000 from Donald Trump's account
# djt <- get_timeline("realDonaldTrump", n = 2000)
# 
# # data frame where each observation (row) is a different tweet
# djt
# 
# # users data for realDonaldTrump is also retrieved.
# # access it via users_data() users_data(hrc)
# users_data(djt)
# ## End(Not run)

Run the code above in your browser using DataLab