bind_tweets: Bind information stored as JSON files

View source: R/bind_tweets.R

bind_tweetsR Documentation

Bind information stored as JSON files

Description

This function binds information stored as JSON files. The experimental function convert_json converts individual JSON files into either "raw" or "tidy" format.

Usage

bind_tweets(data_path, user = FALSE, verbose = TRUE, output_format = NA)

convert_json(data_file, output_format = "tidy")

Arguments

data_path

string, file path to directory of stored tweets data saved as data_id.json and users_id.json

user

If FALSE, this function binds JSON files into a data frame containing tweets; data frame containing user information otherwise. Ignore if output_format is not NA

verbose

If FALSE, messages are suppressed

output_format

[Experimental] string, if it is not NA, this function return an unprocessed data.frame containing either tweets or user information. Currently, this function supports the following format(s)

  • "raw"List of data frames; Note: not all data frames are in Boyce-Codd 3rd Normal Form

  • "tidy"Tidy format; all essential columns are available

data_file

string, a single file path to a JSON file; or a vector of file paths to JSON files of stored tweets data saved as data_id.json

Details

By default, bind_tweets binds into a data frame containing tweets (from data_id.json files).

If users is TRUE, it binds into a data frame containing user information (from users_id.json).

Value

a data.frame containing either tweets or user information

Examples

## Not run: 
# bind json files in the directory "data" into a data frame containing tweets
bind_tweets(data_path = "data/")

# bind json files in the directory "data" into a data frame containing user information
bind_tweets(data_path = "data/", user = TRUE)

# bind json files in the directory "data" into a "tidy" data frame / tibble
bind_tweets(data_path = "data/", user = TRUE, output_format = "tidy")

## End(Not run)

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