tot_plot | R Documentation |
Uses a bar graph to visualize patterns in sentence length and grouping variables by turn of talk.
tot_plot(
dataframe,
text.var,
grouping.var = NULL,
facet.vars = NULL,
tot = TRUE,
transform = FALSE,
ncol = NULL,
ylab = NULL,
xlab = NULL,
bar.space = 0,
scale = NULL,
space = NULL,
plot = TRUE
)
dataframe |
A dataframe that contains the text variable and optionally the grouping.var and tot variables. |
text.var |
The text variable (character string). |
grouping.var |
The grouping variables to color by. Default |
facet.vars |
An optional single vector or list of 1 or 2 to facet by. |
tot |
The turn of talk variable (character string). May be |
transform |
logical. If |
ncol |
number of columns.
|
ylab |
Optional y label. |
xlab |
Optional x label. |
bar.space |
The amount space between bars (ranging between 1 and 0). |
scale |
Should scales be fixed ( |
space |
If |
plot |
logical. If |
Invisibly returns the ggplot2 object.
## Not run:
dataframe <- sentSplit(DATA, "state")
tot_plot(dataframe, "state")
tot_plot(DATA, "state", tot=FALSE)
tot_plot(dataframe, "state", bar.space=.03)
tot_plot(dataframe, "state", "sex")
tot_plot(dataframe, "state", "person", tot = "sex")
tot_plot(mraja1, "dialogue", "fam.aff", tot=FALSE)
tot_plot(mraja1, "dialogue", "died", tot=FALSE)
tot_plot(mraja1, "dialogue", c("sex", "fam.aff"), tot=FALSE) +
scale_fill_hue(l=40)
tot_plot(mraja1, "dialogue", c("sex", "fam.aff"), tot=FALSE)+
scale_fill_brewer(palette="Spectral")
tot_plot(mraja1, "dialogue", c("sex", "fam.aff"), tot=FALSE)+
scale_fill_brewer(palette="Set1")
## repeated measures
rajSPLIT2 <- do.call(rbind, lapply(split(rajSPLIT, rajSPLIT$act), head, 25))
tot_plot(rajSPLIT2, "dialogue", "fam.aff", facet.var = "act")
## add mean and +/- 2 sd
tot_plot(mraja1, "dialogue", grouping.var = c("sex", "fam.aff"), tot=FALSE)+
scale_fill_brewer(palette="Set1") +
geom_hline(aes(yintercept=mean(word.count))) +
geom_hline(aes(yintercept=mean(word.count) + (2 *sd(word.count)))) +
geom_hline(aes(yintercept=mean(word.count) + (3 *sd(word.count)))) +
geom_text(parse=TRUE, hjust=0, vjust=0, family="serif", size = 4, aes(x = 2,
y = mean(word.count) + 2, label = "bar(x)")) +
geom_text(hjust=0, vjust=0, family="serif", size = 4, aes(x = 1,
y = mean(word.count) + (2 *sd(word.count)) + 2, label = "+2 sd")) +
geom_text(hjust=0, vjust=0, family="serif", size = 4, aes(x = 1,
y = mean(word.count) + (3 *sd(word.count)) + 2, label = "+3 sd"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.