get_timeline

0th

Percentile

get_timeline

Returns timeline of tweets from a specified Twitter user.

Usage
get_timeline(user, n = 200, max_id = NULL, parse = TRUE, 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.

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

Aliases
  • get_timeline
Examples
# 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)
# }
Documentation reproduced from package rtweet, version 0.3.0, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.