Description Usage Arguments Value Examples
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.
1 2 | get_word_freq(num_posts, subreddit, num_words = 100,
colour_pallete = "Dark2", num_colours = 8)
|
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 |
A data frame with the 100 most common words and their frequencies and a plot of the wordcloud
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.