extract_users: Extract All Users

Description Usage Arguments Author(s) Examples

View source: R/users.R

Description

Extract all users and relevant data, including retweeters, quoters, repliers, and mentions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
extract_users(
  tweet_df,
  summarize = TRUE,
  split = FALSE,
  as_tibble = tweetio_as_tibble(),
  ...
)

## S3 method for class 'data.frame'
extract_users(
  tweet_df,
  summarize = TRUE,
  split = FALSE,
  as_tibble = tweetio_as_tibble(),
  ...
)

## S3 method for class 'data.table'
extract_users(
  tweet_df,
  summarize = TRUE,
  split = FALSE,
  as_tibble = tweetio_as_tibble(),
  ...
)

Arguments

tweet_df

A data frame of tweets, as obtained by read_tweets() or one of {rtweet}'s collection functions, e.g. rtweet::search_tweets().

summarize

logical(1L), Default: TRUE. Whether to aggregate all users data to a single row containing the most recent non-missing values.

split

logical(1L), Default: FALSE. Whether to split users into separate data frames and return a list of those data frames, retaining all instances where each user was observed. Ignored if summarize is TRUE.

as_tibble

<logical>, Default: tweetio_as_tibble(). Whether a tibble::tibble() should be returned. Ignored if the {tibble} package is not installed.

...

Arguments passed to or from other methods.

Author(s)

Brendan Knapp brendan.g.knapp@nps.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
path_to_tweet_file <- example_tweet_file()
tweet_df <- read_tweets(path_to_tweet_file)

extract_users(tweet_df, as_tibble = TRUE) 

extract_users(tweet_df, summarize = FALSE, as_tibble = TRUE) 

split_users <- extract_users(tweet_df, summarize = FALSE, split = TRUE, as_tibble = TRUE)

# first 3 users with more than 5 observations.
split_users[vapply(split_users, function(.x) nrow(.x) > 5, logical(1L))][1:3]

knapply/tweetio documentation built on Dec. 22, 2020, 7:15 p.m.