The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
This is an introduction to wordcloud2
package. This package provides an HTML5 interface to wordcloud for data visualization. Timdream’s wordcloud2.js is used in this package.
This document show two main function in Wordcloud2
:
wordcloud2
: provide traditional wordcloud with HTML5letterCloud
: provide wordcloud with selected word(letters).You may have installed this package. Well, I still want to leave these codes here for installing.
require(devtools)
install_github("lchiffon/wordcloud2")
wordlcoud2
functionYou can use wordcloud directly:
library(wordcloud2)
wordcloud2(data = demoFreq)
demoFreq
is a data.frame including word and freq in each column.
head(demoFreq)
## word freq
## oil oil 85
## said said 73
## prices prices 48
## opec opec 42
## mln mln 31
## the the 26
data
size
fontFamily
fontWeight
color
minSize
backgroundColor
gridSize
minRotation
maxRotation
rotateRatio
shape
ellipticity
figPath
widgetsize
wordcloud2(demoFreq, color = "random-light", backgroundColor = "grey")
wordcloud2(demoFreq, minRotation = -pi/6, maxRotation = -pi/6, minSize = 10,
rotateRatio = 1)
For example, t.png
is A BIRD with black and white:
figPath = system.file("examples/t.png",package = "wordcloud2")
wordcloud2(demoFreq, figPath = figPath, size = 1.5,color = "skyblue")
letterCloud
functionletterCloud
provide the function to create a wordcloud with a word, like this:
letterCloud(demoFreq, word = "R", size = 2)
Or:
letterCloud(demoFreq, word = "WORDCLOUD2", wordSize = 1)
data
word
wordSize
letterFont
...
See Example:
if(require(shiny)){
library(wordcloud2)
# Global variables can go here
n <- 1
# Define the UI
ui <- bootstrapPage(
numericInput('size', 'Size of wordcloud', n),
wordcloud2Output('wordcloud2')
)
# Define the server code
server <- function(input, output) {
output$wordcloud2 <- renderWordcloud2({
# wordcloud2(demoFreqC, size=input$size)
wordcloud2(demoFreq, size=input$size)
})
}
# Return a Shiny app object
# Sys.setlocale("LC_CTYPE","chs") #if you use Chinese character
## Do not Run!
shinyApp(ui = ui, server = server)
}
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.