Learn R Programming

qdap (version 0.2.5)

word.network.plot: Word Network Plot

Description

A network plot of words. Shows the interconnected and supporting use of words between textual units containing key terms.

Usage

word.network.plot(text.var, grouping.var = NULL,
    target.words = NULL, stopwords = Top100Words,
    label.cex = 0.8, label.size = 0.5, edge.curved = TRUE,
    vertex.shape = "circle", edge.color = "gray70",
    label.colors = "black", layout = NULL,
    title.name = NULL, title.padj = -4.5,
    title.location = 3, title.font = NULL, title.cex = 0.8,
    log.labels = FALSE, title.color = "black",
    legend = NULL, legend.cex = 0.8,
    legend.location = c(-1.54, 1.41), plot = TRUE,
    char2space = "~~", ...)

Arguments

text.var
The text variable.
grouping.var
The grouping variables. Default NULL generates one word list for all text. Also takes a single grouping variable or a list of 1 or more grouping variables.
target.words
A named list of vectors of words whose length corresponds to label.colors (+1 length in cloud colors for non-matched terms).
stopwords
Words to exclude from the analysis (default is Top100Words).
label.cex
The magnification to be used for network plot labels relative to the current setting of cex. Default is .8.
log.labels
logical. If TRUE uses a proportional log label for more readable labels. The formula is: log(SUMS)/max(log(SUMS))). label.size adds more control over the label sizes.
label.size
An optional sizing constant to add to labels if log.labels is TRUE.
edge.curved
logical. If TRUE edges will be curved rather than straight paths.
vertex.shape
The shape of the vertices (see igraph.vertex.shapes for more).
edge.color
A character vector of length one corresponding to the color of the plot edges.
label.colors
A character vector of length one corresponding to the color of the labels.
layout
Layout types supported by igraph. See layout.
title.name
The title of the plot.
title.padj
Adjustment for the network plot title. For strings parallel to the axes, padj = 0 means right or top alignment, and padj = 1 means left or bottom alignment.
title.location
On which side of the network plot (1=bottom, 2=left, 3=top, 4=right).
title.font
The font family of the cloud title.
title.cex
Character expansion factor for the title. NULL and NA are equivalent to 1.0.
title.color
A character vector of length one corresponding to the color of the title.
legend
A character vector of names corresponding to the number of vectors in match.string.
legend.cex
Character expansion factor for the network plot legend. NULL and NA are equivalent to 1.0.
legend.location
The x and y co-ordinates to be used to position the network plot legend. The location may also be specified by setting x to a single keyword from the list "bottomright", "bottom", "bottomleft", "le
plot
logical. If TRUE plots a network plot of the words.
char2space
A vector of characters to be turned into spaces. If char.keep is NULL, char2space will activate this argument.
...
Other arguments passed to strip.

See Also

word.network.plot, graph.adjacency

Examples

Run this code
word.network.plot(text.var=DATA$state, grouping.var=DATA$person)
word.network.plot(text.var=DATA$state, grouping.var=list(DATA$sex,
    DATA$adult))
word.network.plot(text.var=DATA$state, grouping.var=DATA$person,
    title.name = "TITLE", log.labels=TRUE)
word.network.plot(text.var=raj.act.1$dialogue, grouping.var=raj.act.1$person,
  stopwords = Top200Words)

#insert double tilde ("~~") to keep dual words (e.i., first last name)
alts <- c(" fun", "I ")
state2 <- mgsub(alts, gsub("\\s", "~~", alts), DATA$state)
word.network.plot(text.var=state2, grouping.var=DATA$person)

Run the code above in your browser using DataLab