Heart-shaped wordcloud, celebrating Colombia peace treaty

[This article was first published on R – AmitKohli.com, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This is a lightening quick post just providing the script to draw a heart-shaped wordcloud, using the awesome wordcloud2 package. See the resulting image here:

colombia

 

Apparently, the original code allows you to fit a wordcloud to any shape, even custom shapes, but I didn’t find that functionality pushed out into R yet (a peace sign would have been awesome in this case).

In any event, here’s the code to accomplish this chart. Sorry for the very very short post, I’m working on something big! Stay tuned!

########################################################################
## Title: Draw heart-shaped wordcloud
## Date: 2016-09-26
########################################################################

## Load libraries
library(twitteR)
library(dplyr)
library(httr)
library(rvest)
library(wordcloud2) # devtools::install_github("lchiffon/wordcloud2")

## SETUP (you need to authenticate on twitter... put in your secret codes here)

setup_twitter_oauth("secret1", "secret2")

## THING TO LOOK FOR

topik

To leave a comment for the author, please follow the link and comment on their blog: R – AmitKohli.com.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)