Return the tweet count per day, hour or minute for conversation ids.
tcn_counts(
ids = NULL,
token = NULL,
endpoint = "recent",
start_time = NULL,
end_time = NULL,
granularity = "day",
retry_on_limit = TRUE,
verbose = TRUE
)
List. Conversation ids.
List. Twitter API tokens.
Character string. Twitter API v2 search endpoint. Can be either "recent" for the last 7 days or "all" if users app has access to historical "full-archive" tweets. Default is "recent".
Character string. Earliest tweet timestamp to return (UTC in ISO 8601 format). If NULL API will default to 30 days before end_time. Default is NULL.
Character string. Latest tweet timestamp to return (UTC in ISO 8601 format). If NULL API will default to now - 30 seconds. Default is NULL.
Character string. Granularity or period for tweet counts. Can be "day", "minute" or "hour". Default is "day".
Logical. When the API v2 rate-limit has been reached wait for reset time. Default is TRUE.
Logical. Output additional information. Default is TRUE
.
A dataframe of conversation ids and counts.
A rate-limit of 300 requests per 15 minute window applies. If a conversation count request contains more than 31 days-worth of results it will use more than one request as API results will be paginated.
if (FALSE) {
# get tweet count for conversation thread over approximately 7 days
counts <-
tcn_counts(
ids = c("xxxxxx", "xxxxxx"),
token = token,
endpoint = "all",
start_time = "2020-09-30T01:00:00Z",
end_time = "2020-10-07T01:00:00Z",
granularity = "day"
)
# total tweets per conversation id for period
counts$counts |> dplyr::count(conversation_id, wt = tweet_count)
}