Build tweet query according to targeted parameters.
build_query(
query = NULL,
exact_phrase = NULL,
users = NULL,
reply_to = NULL,
retweets_of = NULL,
exclude = NULL,
is_retweet = NULL,
is_reply = NULL,
is_quote = NULL,
is_verified = NULL,
remove_promoted = FALSE,
has_hashtags = NULL,
has_cashtags = NULL,
has_links = NULL,
has_mentions = NULL,
has_media = NULL,
has_images = NULL,
has_videos = NULL,
has_geo = NULL,
place = NULL,
country = NULL,
point_radius = NULL,
bbox = NULL,
lang = NULL,
conversation_id = NULL,
url = NULL
)
string or character vector, search query or queries
If TRUE
, only tweets will be returned matching the exact phrase
string or character vector, user handles to collect tweets from the specified users
string or character vector, user handles to collect replies to the specified users
string or character vector, user handles to collects retweets of tweets by the specified users
string or character vector, tweets containing the keyword(s) will be excluded
If TRUE
, only retweets will be returned; if FALSE
, retweets will be excluded; if NULL
, both retweets and other tweet types will be returned.
If TRUE
, only replies will be returned; if FALSE
, replies will be excluded; if NULL
, both replies and other tweet types will be returned.
If TRUE
, only quote tweets will be returned; if FALSE
, quote tweets will be excluded; if NULL
, both quote tweets and other tweet types will be returned.
If TRUE
, only tweets from verified accounts will be returned; if FALSE
, tweets from verified accounts will be excluded; if NULL
, both verified account tweets and tweets from non-verified accounts will be returned.
If TRUE
, tweets created for promotion only on ads.twitter.com are removed
If TRUE
, only tweets containing hashtags will be returned; if FALSE
, tweets containing hashtags will be excluded; if NULL
, both tweets containing hashtags and tweets without hashtags will be returned.
If TRUE
, only tweets containing cashtags will be returned; if FALSE
, tweets containing cashtags will be excluded; if NULL
, both tweets containing cashtags and tweets without cashtags will be returned.
If TRUE
, only tweets containing links (and media) will be returned; if FALSE
, tweets containing links (and media) will be excluded; if NULL
, both tweets containing links (and media) and tweets without links (and media) will be returned.
If TRUE
, only tweets containing mentions will be returned; if FALSE
, tweets containing mentions will be excluded; if NULL
, both tweets containing mentions and tweets without mentions will be returned.
If TRUE
, only tweets containing media such as a photo, GIF, or video (as determined by Twitter) will be returned will be returned; if FALSE
, tweets containing media will be excluded; if NULL
, both tweets containing media and tweets without media will be returned.
If TRUE
, only tweets containing (recognized URLs to) images will be returned will be returned will be returned; if FALSE
, tweets containing images will be excluded; if NULL
, both tweets containing images and tweets without images will be returned.
If TRUE
, only tweets containing contain videos (recognized as native videos uploaded directly to Twitter) will be returned will be returned; if FALSE
, tweets containing videos will be excluded; if NULL
, both tweets containing videos and tweets without videos will be returned.
If TRUE
, only tweets containing geo information (Tweet-specific geolocation data provided by the Twitter user) will be returned; if FALSE
, tweets containing geo information will be excluded; if NULL
, both tweets containing geo information and tweets without geo information will be returned.
string, name of place e.g. "London"
string, name of country as ISO alpha-2 code e.g. "GB"
numeric, a vector of two point coordinates latitude, longitude, and point radius distance (in miles)
numeric, a vector of four bounding box coordinates from west longitude to north latitude
string, a single BCP 47 language identifier e.g. "fr"
string, return tweets that share the specified conversation ID
string, url
a query string
This function is already called within the main
get_all_tweets
function.
It may also be called separately and the output saved as
a character object query string to be input as query parameter to get_all_tweets
.
# NOT RUN {
query <- build_query(query = "happy", is_retweet = FALSE,
country = "US",
place = "seattle",
point_radius = c(-122.33795253639994, 47.60900846404393, 25),
lang = "en")
query <- build_query(query = "twitter",
point_radius = c(-122.33795253639994, 47.60900846404393, 25),
lang = "en")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab