cloud | R Documentation |
Creates word cloud diagram text and value data.frame.
cloud( df, text.column = "text", value.column = "value", group.column = "group", text.color = c("group", "word", "none"), color.scheme = c("Rainbow", names(d3po::color.schemes)), legend.font.size = 20, width = NULL, height = NULL, viewer = c("internal", "external", "browser") )
df |
data.frame containing text, value, and group data. |
text.column |
Name of column containing text. Defaults to "text". |
value.column |
Name of column containing edge values. Defaults to "value". |
group.column |
Name of column containing group data. Defaults to "group". If group.column is not found in df, a new column with a single group will be created. |
text.color |
How to color text; "group" (default) colors by group, "word" colors by word, and "none" colors all words black. |
color.scheme |
Color scheme to use in visualization. See color.schemes for more details. |
legend.font.size |
Size of font in legend in points. Defaults to 20. |
width |
Desired width for output widget. |
height |
Desired height for output widget. |
viewer |
"internal" to use the RStudio internal viewer pane for output; "external" to display in an external RStudio window; "browser" to display in an external browser. |
Utilizes a script similar to https://observablehq.com/@d3/word-cloud adapted to work with r2d3.
A d3 object as returned by r2d3.
df = data.frame(text = c("foo", "bar", "spam", "eggs"), value = 2 * c(0.5, 10, 1, 10), group = c("Not Python", "Not Python", "Python", "Python")) cloud(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.