Learn R Programming

academictwitteR (version 0.3.1)

hydrate_tweets: Hydrate Tweets Based On Tweet IDs

Description

This function is helpful for hydrating Tweet IDs (i.e. getting the full content of tweets from a list of Tweet IDs).

Usage

hydrate_tweets(
  ids,
  bearer_token = get_bearer(),
  data_path = NULL,
  context_annotations = FALSE,
  bind_tweets = TRUE,
  verbose = TRUE,
  errors = FALSE
)

Arguments

ids

a character vector of Tweet IDs

bearer_token

string, bearer token

data_path

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

context_annotations

If TRUE, context_annotations will be fetched.

bind_tweets

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

verbose

If FALSE, query progress messages are suppressed

errors

logical, if TRUE, the error capturing mechanism is enabled. See details below.

Value

When bind_tweets is TRUE, the function returns a data frame. The data_path (invisibly) if bind_tweets is FALSE

Details

When the error capturing mechanism is enabled, Tweets IDs that cannot be queried (e.g. with error) are stored as errors_*.json files. If bind_tweets is TRUE, those error Tweets IDs are retained in the returned data.frame with the column error indicating the error.

Examples

Run this code
# NOT RUN {
hydrate_tweets(c("1266876474440761346", "1266868259925737474", "1266867327079002121",
"1266866660713127936", "1266864490446012418", "1266860737244336129",
"1266859737615826944", "1266859455586676736", "1266858090143588352",
"1266857669157097473"))
# }

Run the code above in your browser using DataLab