rtweet (version 0.3.6)

search_users: search_users

Description

Returns data frame of users data using a provided search query.

Usage

search_users(q, n = 20, parse = TRUE, clean_tweets = FALSE,
  as_double = FALSE, token = NULL, verbose = TRUE)

Arguments

q

Character, search query of no greater than 500 characters maximum.

n

Numeric, specifying the total number of desired users to return. Defaults to 100. Maximum number of users returned from a single search is 1,000.

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

verbose

Logical, indicating whether or not to output processing/retrieval messages.

Value

Data frame of users returned by query.

See Also

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

Other users: lookup_users, users_data

Examples

Run this code
# NOT RUN {
# search for 1000 tweets mentioning Hillary Clinton
pc <- search_users(q = "political communication", n = 1000)

# data frame where each observation (row) is a different user
pc

# tweets data also retrieved. can access it via tweets_data()
users_data(hrc)
# }

Run the code above in your browser using DataCamp Workspace