Awesome
<!-- README.md is generated from README.Rmd. Please edit that file -->d3wordcloud
What is it?
d3wordcloud is a wrapper for the Word Cloud Layout by Jason Davies based on htmlwidgets.
How it works?!
The main function d3wordcloud
needs only words
and freqs
. Just
like the old good wordcloud package. See demo
here.
library("d3wordcloud")
words <- c("I", "love", "this", "package", "but", "I", "don't", "like", "use", "wordclouds")
freqs <- sample(seq(length(words)))
d3wordcloud(words, freqs)
How can you get it?
I know! you already know how to install it
devtools::install_github("jbkunst/d3wordcloud")
Parameters
There are parameter for make your word cloud like you like/want:
words
: The wordsfreqs
: Their frequenciespadding
: The separation between words. Default value is0
.colors
: The color for wordcloud, if the length of words, and colors are the same, then each word will have its own color, in other case a grandien between the colors is generated (the order is important here).size.scale
: The scale to use for scale the words sizes (freqs
). Options arelinear
,sqrt
andlog
. Default value islinear
.color.scale
: The scale to use for scale the colors according to sizes (freqs
). Options arelinear
,sqrt
andlog
. Default value islinear
.font
: The font to use in thw the word cloud. Default value isOpen Sans
.spiral
: The way to construct the wordcloud. Options arearchimedean
andrectangular
. Default value isarchimedean
.rotate.min
: Minimum angle for (random) rotation. Default value is-30
.rotate.max
: Maximum angle for (random) rotation. Default value is30
.tooltip
: Do you want tooltips showing the frequecny on cursor hover? ;)label
: Alternate text for tooltip to display.rangesizefont
A 2 length numeric vector indicating the size of text (this is usefull if you have sentences instead of words).
You can see this parameter in action here http://rpubs.com/jbkunst/133106.
Demo
Check here https://jbkunst.shinyapps.io/d3wordcloud.
Sometimes I exceed the hours on the basic plan in shiniapps.io. You can always can view here: http://rpubs.com/jbkunst/133106.
An old demo gif:
References
Similar packages
- rWordCloud. A package with similar functionalities.
Recommendations
- Always have the latest version of packages.