knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
This is a personal project that is in development - it is not working properly
Just for fun, I've had a go at producing word cloud type graphics in R. At the moment, it's slow and clunky. Personally I don't believe that word clouds are a particularly useful or insightful way to visualise text analysis, but I do think they can look rather pretty and be good fun to make.
I'm not really interested in developing code to extract words and their respective weights from a body of text. Here I am just interested in how to place the words (scaled to their weighting) on the page in the form of a word cloud. As such, the code im developing here needs to be supplied with a vector of words and a vector of their weights from which a word cloud will be generated.
library(cloudr)
cloudr
has a raw data set obama
- a dataframe of words and their weights from Obama's 2016 state of the union speech downloaded from https://help.xlstat.com/customer/en/portal/articles/2918639-word-cloud-tutorial-in-excel-?b_id=9283
obama[1:10, ]
wc(obama$word[1:100], obama$count[1:100], seed=4, lower_cex = 0.5, upper_cex = 6, lo_col = "grey", markup = FALSE) wc(obama$word[1:100], obama$count[1:100], seed=4, lower_cex = 0.5, upper_cex = 6, hi_col = "orange", lo_col = "red", markup = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.