Title: | Model Word Clouds |
---|---|
Description: | Makes a word cloud of text, sized by the frequency of the word, and colored either by user-specified colors or colored by the strength of the coefficient of that text derived from a regression model. |
Authors: | Peter Hurford [aut, cre] |
Maintainer: | Peter Hurford <[email protected]> |
License: | LGPL-2.1 |
Version: | 0.1 |
Built: | 2024-11-16 06:37:25 UTC |
Source: | CRAN |
Make a word cloud.
wordcloud(model_object = NULL, words = NULL, freq = NULL, coefficients = NULL, colors = "black", scale = c(4, 0.5), min_freq = 3, max_words = Inf, random_order = FALSE, random_color = FALSE, rot_per = 0, bg_color = "#FFFFFF")
wordcloud(model_object = NULL, words = NULL, freq = NULL, coefficients = NULL, colors = "black", scale = c(4, 0.5), min_freq = 3, max_words = Inf, random_order = FALSE, random_color = FALSE, rot_per = 0, bg_color = "#FFFFFF")
model_object |
lm. A linear model object. If this is passed, words, freq, and coefficients can be derived and do not need to be passed. |
words |
character. A vector of words to plot. |
freq |
numeric. The frequency of those words. |
coefficients |
numeric. If provided, colors will be assigned according to coefficients. |
colors |
character. The colors to use for plotting. |
scale |
numeric. The range of sizes. |
min_freq |
numeric. Words with less frequency than this will not be plotted. |
max_words |
numeric. Don't plot more words than this amount. |
random_order |
logical. Should words be plotted in a random_order or by frequency (default FALSE)? |
random_color |
logical. Allocate words a color by random? (default FALSE). |
rot_per |
numeric. Amount of rotation to apply to each word, between 0 and 1. Defaults to 0 (no rotation). |
bg_color |
character. The color of the background. |
data(iris) model <- lm(Petal.Width ~ Species, iris) library(modelwordcloud) colors <- c("red", "orange", "blue") wordcloud(model, colors = colors) words_and_freqs <- rle(as.character(iris$Species)) freqs <- words_and_freqs$lengths words <- words_and_freqs$values coefficients <- model$coefficients wordcloud(words = words, freq = freqs, coefficients = coefficients, colors = colors)
data(iris) model <- lm(Petal.Width ~ Species, iris) library(modelwordcloud) colors <- c("red", "orange", "blue") wordcloud(model, colors = colors) words_and_freqs <- rle(as.character(iris$Species)) freqs <- words_and_freqs$lengths words <- words_and_freqs$values coefficients <- model$coefficients wordcloud(words = words, freq = freqs, coefficients = coefficients, colors = colors)