First, Wordcloud installation instructions
Install.packages ("Wordcloud");
Second, WORDCLOUD2 installation instructions
Install.packages ("Devtools");
Devtools::install_github ("Lchiffon/wordcloud2", type= "source")
Error message:
Workaround:
Install.packages ("Htmltools");
Three, Wordcloud parameter description
3.1 Function prototypes
Wordcloud (Words,freq,scale=c (4,.5), Min.freq=3,max.words=inf,random.order=true, Random.color=false, rot.per=. 1,colors= "Black", Ordered.colors=false,use.r.layout=false,...)
3.2 Common parameters
(1)words--keyword list
(2)freq--keywords corresponding to the word frequency list
(3)scale--The Font size list. C ( maximum font size , minimum font size )
(4)min.freq-Minimum limit frequency. Keywords below this frequency will not be displayed.
(5)max.words--Limit the number of keywords on the word cloud. The number of keywords that finally appear on the word cloud does not exceed this limit.
(6)Random.order-controls the order in which keywords are arranged on the graph. T: keywords randomly arranged;F: Keywords are arranged in descending order of the frequency heart position, that is, the words with large frequency appear in the central position.
(7)random.color--Control the font color of keywords. T: Font color is randomly assigned;F: Assigns font color based on frequency.
(8)rot.per--control key point placement angle. T: horizontal placement;F: Rotate the dimension.
(9)colors--Font Color list
ordered.colors-controls theorder in which font colors are used. T: Give the font color of each keyword in the order specified, (appears to require a list of keywords for each color in the color list), andF: Give the font color in any way.
(one)use.r.layout=t; F
iv. parameter description of WORDCLOUD2
4.1 Function prototypes
WORDCLOUD2 (data, size = 1, minSize = 0, gridSize = 0,
fontFamily = NULL, fontweight = ' normal ',
color = ' Random-dark ', backgroundcolor = "White", minrotation =-pi/4, maxrotation = Pi/4, Rotateratio = 0.4, shape = ' Circle ', ellipticity = 0.65, widgetsize = NULL)
4.2 Common parameters:
(1) Data: The generation of word clouds, including specific words and frequency;
(2) Size: Font size, default is 1, in general, the smaller the value, the more obvious the resulting shape contour;
(3) fontFamily: fonts, such as ' Microsoft Ya Black ';
(4) FontWeight: Font weight, including ' normal ', ' bold ' and ' + ';;
(5) Color: Font color, you can choose ' Random-dark ' and 'random-light', in fact, is the color palette;
(6) BackgroundColor: Background color, support the R language commonly used colors, such as ' Gray ', ' Blcak ', but also can not support more specific color choices, such as ' gray20 ';
(7) Minrontatin and Maxrontatin: The minimum and maximum value of the font rotation angle range, when selected, the font will rotate randomly within the range;
(8) rotationration: Font rotation ratio, if set to 1, all the words will rotate;
(9) Shape: Word Cloud shape selection, default is ' circle ', that is, circle. You can also choose ' cardioid ' (Apple-shaped or heart-shaped), ' star ' (Star-shaped), ' diamond ' (diamonds), ' Triangle-forward ' (triangle), ' triangle '(triangle), ' Pentagon ' (pentagon);
Word cloud for R language: WORDCLOUD&WORDCLOUD2 installation and parameter description