clean_df: Adds new column(s) to dataframe returned by rtweet...

Description Usage Arguments Value Examples

View source: R/rtweetclean.R

Description

Returns a new dataframe containing additional columns that were not in the original Generatable columns include... text_only: strips emojis, hashtags, and hyperlinks from the text column word_count: counts the number of words contained in the text_only column emojis: contains the extracted emojis from text proportion_of_avg_retweets: a proportion value of how many retweets a tweet received compared to the account average proportion_of_avg_favorites: a proportion value of how many favorites a tweet received compared to the account average

Usage

1
2
3
4
5
6
7
8
clean_df(
  raw_tweets_df,
  text_only = TRUE,
  word_count = TRUE,
  emojis = TRUE,
  proportion_of_avg_retweets = TRUE,
  proportion_of_avg_favorites = TRUE
)

Arguments

raw_tweets_df

dataframe

text_only

bool

word_count

bool

emojis

bool

proportion_of_avg_retweets

bool

proportion_of_avg_favorites

bool

Value

dataframe

Examples

1
2
3
4
5
6
7
8
9
text <- c("example tweet text 1 @user2 @user",
"#example #tweet 2 ",
"example tweet 3 https://t.co/G4ziCaPond",
"example tweet 4")
retweet_count <- c(43, 12, 24, 29)
favorite_count <- c(85, 41, 65, 54)
raw_df <- data.frame(text, retweet_count, favorite_count)
clean_df(raw_df)
clean_df(raw_df, emojis = FALSE)

UBC-MDS/rtweetclean documentation built on April 28, 2021, 7:26 p.m.