count_all_tweets: Count tweets from full archive search

View source: R/count_all_tweets.R

count_all_tweetsR Documentation

Count tweets from full archive search

Description

This function returns aggregate counts of tweets by query string or strings between specified date ranges.

Usage

count_all_tweets(
  query = NULL,
  start_tweets,
  end_tweets,
  bearer_token = get_bearer(),
  n = 100,
  file = NULL,
  data_path = NULL,
  export_query = TRUE,
  bind_tweets = TRUE,
  granularity = "day",
  verbose = TRUE,
  ...
)

Arguments

query

string or character vector, search query or queries

start_tweets

string, starting date

end_tweets

string, ending date

bearer_token

string, bearer token

n

integer, upper limit of tweet counts to be fetched (i.e., for 365 days n must be at least 365). Default is 100.

file

string, name of the resulting RDS file

data_path

string, if supplied, fetched data can be saved to the designated path as jsons

export_query

If TRUE, queries are exported to data_path

bind_tweets

If TRUE, tweets captured are bound into a data.frame for assignment

granularity

string, the granularity for the search counts results. Options are "day"; "hour"; "minute". Default is day.

verbose

If FALSE, query progress messages are suppressed

...

arguments will be passed to build_query() function. See ?build_query() for further information.

Value

a data.frame

Examples

## Not run: 

count_all_tweets(query = "Hogmanay", 
          start_tweets = "2019-12-2700:00:00Z", 
          end_tweets = "2020-01-05T00:00:00Z", 
          bearer_token = get_bearer())
          
count_all_tweets(query = "Hogmanay", 
          start_tweets = "2019-12-27T00:00:00Z", 
          end_tweets = "2020-01-05T00:00:00Z", 
          bearer_token = get_bearer(),
          granularity = "hour",
          n = 500)

## End(Not run)

academictwitteR documentation built on March 18, 2022, 6:41 p.m.