cloud: Word cloud diagram

View source: R/cloud.R

cloudR Documentation

Word cloud diagram

Description

Creates word cloud diagram text and value data.frame.

Usage

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")
)

Arguments

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.

Details

Utilizes a script similar to https://observablehq.com/@d3/word-cloud adapted to work with r2d3.

Value

A d3 object as returned by r2d3.

Examples

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)


tkmckenzie/d3po documentation built on June 2, 2022, 2:41 p.m.