# Install packages
if (!requireNamespace("d3wordcloud", quietly = TRUE)) {
::install_github("jbkunst/d3wordcloud")
devtools
}
# Load packages
library(d3wordcloud)
D3 Wordcloud
Note
Hiplot website
This page is the tutorial for source code version of the Hiplot D3 Wordcloud
plugin. You can also use the Hiplot website to achieve no code ploting. For more information please see the following link:
Display the wordcloudγ
Setup
System Requirements: Cross-platform (Linux/MacOS/Windows)
Programming language: R
Dependent packages:
d3wordcloud
Data Preparation
# Load data
<- read.delim("files/Hiplot/036-d3-wordcloud-data.txt", header = T)
data
# convert data structure
row.names(data) <- data[, 1]
# View data
head(data)
word freq
oil oil 85
said said 73
prices prices 48
opec opec 42
mln mln 31
the the 26
Visualization
# D3 Wordcloud
<- d3wordcloud(
p words = data[, 1],
freqs = data[, 2],
padding = 0,
rotate.min = 0,
rotate.max = 0,
size.scale = "linear",
color.scale = "linear",
spiral = "archimedean",
font = "Arial",
rangesizefont = c(10, 90)
)
p