trans_cloud(text.var = NULL, grouping.var = NULL, word.list = NULL, stem = FALSE, target.words = NULL, expand.target = TRUE, target.exclude = NULL, stopwords = NULL, min.freq = 1, caps = TRUE, caps.list = NULL, random.order = FALSE, rot.per = 0, cloud.colors = NULL, title = TRUE, cloud.font = NULL, title.font = NULL, title.color = "black", title.padj = -4.5, title.location = 3, title.cex = NULL, title.names = NULL, proportional = FALSE, max.word.size = NULL, min.word.size = 0.5, legend = NULL, legend.cex = 0.8, legend.location = c(-0.03, 1.03), char.keep = "~~", char2space = "~~")
NULL
generates
one word list for all text. Also takes a single grouping variable or a list
of 1 or more grouping variables.word_list
.TRUE
the text.var
will be stemmed.cloud.colors
(+1 length in cloud colors for non-matched terms).TRUE
agrep
will be used to expand the target.words
.target.words
.TRUE
selected words will be capitalized.caps
must be
TRUE
).TRUE
adds a title corresponding to the
grouping.var
.NULL
and
NA
are equivalent to 1.0.TRUE
scales the word clouds across
grouping.var to allow cloud to cloud comparisons.NULL
and
NA
are equivalent to 1.0.char.keep
is NULL
, char2space
will activate this
argument.Returns a series of word cloud plots with target words (themes) colored.
Produces word clouds with optional theme coloring by grouping variable.
## <strong>Not run</strong>: # terms <- list( # I=c("i", "i'm"), # mal=qcv(stinks, dumb, distrust), # articles=qcv(the, a, an), # pronoun=qcv(we, you) # ) # # with(DATA, trans_cloud(state, person, target.words=terms, # cloud.colors=qcv(red, green, blue, black, gray65), # expand.target=FALSE, proportional=TRUE, legend=c(names(terms), # "other"))) # # with(DATA, trans_cloud(state, person, target.words=terms, # stopwords=exclude(with(DATA, unique(bag_o_words(state))), # unique(unlist(terms))), # cloud.colors=qcv(red, green, blue, black, gray65), # expand.target=FALSE, proportional=TRUE, legend=names(terms))) # # # #color the negated phrases opposite: # DATA <- qdap::DATA # DATA[1, 4] <- "This is not good!" # DATA[8, 4] <- "I don't distrust you." # # DATA$state <- space_fill(DATA$state, paste0(negation.words, " "), # rm.extra = FALSE) # # txt <- gsub("~~", " ", breaker(DATA$state)) # rev.neg <- sapply(negation.words, paste, negative.words) # rev.pos <- sapply(negation.words, paste, positive.words) # # # tw <- list( # positive=c(positive.words, rev.neg[rev.neg %in% txt]), # negative=c(negative.words, rev.pos[rev.pos %in% txt]) # ) # # # with(DATA, trans_cloud(state, person, # target.words=tw, # cloud.colors=qcv(darkgreen, red, gray65), # expand.target=FALSE, proportional=TRUE, legend=names(tw))) # # DATA <- qdap::DATA ## Reset DATA # ## <strong>End(Not run)</strong>