filter_tweets: Filter tweets

Description Usage Arguments Details Value Examples

View source: R/filter_tweets.R

Description

Filter tweets by keywords.

Usage

1
filter_tweets(data, keywords, include = TRUE)

Arguments

data

Data frame of parsed tweets. Obtained either by using load_tweets or stream_in in conjunction with tweets_with_users.

keywords

Character string of keywords for black- or whitelisting provided via a comma separated character string.

include

Logical. Indicate where to perform exclusive or inclusive filtering. Inclusive filtering is akin to whitelisting keywords. Exclusive filtering is blacklisting certain keywords.

Details

Use this function if you want your Tweets to contain certain keywords. This can be used for iterative filtering to create more coherent topic models. Keyword filtering is always case insensitive (lowercase).

Value

Data frame of Tweets containing specified keywords

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 

library(Twitmo)


# load tweets (included in package)
mytweets <- load_tweets(system.file("extdata", "tweets_20191027-141233.json", package = "Twitmo"))

# Exclude Tweets that mention "football" and/or "mood"
keyword_dict <- "football,mood"
mytweets_reduced <- filter_tweets(mytweets, keywords = keyword_dict, include = FALSE)

## End(Not run)

Twitmo documentation built on Dec. 11, 2021, 10:01 a.m.