Description Usage Arguments Value Note Examples
Converts a wide matrix of counts to tidy form (tags are stretched long-wise with corresponding counts of tags).
1 | tidy_counts(x, ...)
|
x |
A 'term_count' object. |
... |
ignored. |
Returns a tibble with tags and counts in long form (retains all other variables in the 'term_count' object.
n.words
or n.tokens
will be repeated for each row element
id (element_id
) and thus are nested.
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 38 39 | ## On term counts
discoure_markers <- list(
AA__response_cries = c("\\boh", "\\bah", "\\baha", "\\bouch", "yuk"),
AA__back_channels = c("uh[- ]huh", "uhuh", "yeah"),
BB__summons = "\\bhey",
CC__justification = "because"
)
terms1 <- with(presidential_debates_2012,
term_count(dialogue, TRUE, discoure_markers)
)
tidy_counts(terms1)
terms2 <- with(presidential_debates_2012,
term_count(dialogue, list(person, time), discoure_markers)
)
tidy_counts(terms2)
## On token count
library(dplyr)
token_list <- lexicon::nrc_emotions %>%
textshape::column_to_rownames() %>%
t() %>%
textshape::as_list()
token1 <- presidential_debates_2012 %>%
with(token_count(dialogue, TRUE, token_list))
tidy_counts(token1)
token2 <- presidential_debates_2012 %>%
with(token_count(dialogue, list(person, time), token_list))
tidy_counts(token2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.