Description Usage Arguments Value Examples
Plot the counts of groups within a vector or list as a horizontal bar plot.
1 2 3 4 5 6 7 8 9 |
x |
A vector or list of elements. |
n |
Minimum frequency to be shown in the plot. If |
percent |
logical. If |
item.name |
The name of the variable that contains the groups (different element in the vector/list). |
rev |
logical. If |
drop |
logical. If |
... |
ignored. |
ggplot2 object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | x <- sample(LETTERS, 100, TRUE)
y <- lapply(1:100, function(i) sample(LETTERS[1:10], sample(0:5, 1), TRUE))
y <- sapply(y, function(x) {
if(identical(x, character(0))) return(NULL)
x
})
plot_counts(x)
plot_counts(y)
## Example
library(dplyr)
data(presidential_debates_2012)
discoure_markers <- list(
response_cries = c("\\boh", "\\bah", "\\baha", "\\bouch", "yuk"),
back_channels = c("uh[- ]huh", "uhuh", "yeah"),
summons = "hey",
justification = "because"
)
presidential_debates_2012 %>%
with(., term_count(dialogue, TRUE, discoure_markers)) %>%
as_terms() %>%
plot_counts() +
ggplot2::xlab("Tags")
presidential_debates_2012 %>%
with(., term_count(dialogue, TRUE, discoure_markers)) %>%
as_terms() %>%
plot_freq(size=3) +
ggplot2::xlab("Number of Tags")
presidential_debates_2012 %>%
with(., term_count(dialogue, TRUE, discoure_markers)) %>%
as_terms() %>%
plot_counts(percent=FALSE, item.name = "Tags")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.