get_word_freq: Get Title word frequency

Description Usage Arguments Value Examples

Description

This function takes a subreddit and the number of posts we wish to scrape, and returns a data frame with the most common words in the title of the posts and their respective frequencies and a plot of the wordcloud.

Usage

1
2
get_word_freq(num_posts, subreddit, num_words = 100,
  colour_pallete = "Dark2", num_colours = 8)

Arguments

num_posts

Number of reddit posts to be scraped

subreddit

The subreddit to be scraped

num_words

The number of words to be plotted in the wordcloud

colour_pallete

The colour_pallete to be used in the wordcloud

num_colours

The number of different colours to be used in the wordcloud

Value

A data frame with the 100 most common words and their frequencies and a plot of the wordcloud

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
num_posts = 10000;
subreddit = "rabbits"

#Default plot
words_freq <- get_word_freq(num_posts, subreddit)

#Custom plot
get_word_freq <- get_word_freq(num_posts, subreddit,
                                num_words = 50,
                                colour_pallete = "Set1",
                                num_colours = 5)

JoshuaBean/RedditText documentation built on June 7, 2019, 2:35 p.m.