Description Usage Arguments Value Examples
View source: R/combine_counts.R
Combine term_count
and token_count
objects.
1 | combine_counts(x, y, mapping = NULL, ...)
|
x |
A |
y |
A |
mapping |
A list of named vectors where the vector names are the collapsed
column names and the vectors are the names of the columns to collapse. The
default, |
... |
ignored. |
Returns a combine_counts
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ## Not run:
token_list <- list(
list(
person = c('sam', 'i')
),
list(
place = c('here', 'house'),
thing = c('boat', 'fox', 'rain', 'mouse', 'box', 'eggs', 'ham')
),
list(
no_like = c('not like'),
thing = c('train', 'goat')
)
)
(y <- token_count(sam_i_am, grouping.var = TRUE, token.list = token_list))
term_list <- list(
list(Is = c("I")),
list(
oulds = c("ould"),
thing = c('egg', 'ham')
)
)
(x <-term_count(sam_i_am, grouping.var = TRUE, term_list, ignore.case = FALSE))
combine_counts(x, y)
combine_counts(y, x)
library(lexicon)
library(textshape)
library(dplyr)
token_list <- lexicon::nrc_emotions %>%
textshape::column_to_rownames() %>%
t() %>%
textshape::as_list()
a <- presidential_debates_2012 %>%
with(token_count(dialogue, list(person, time), token_list))
term_list <- list(
response_cries = c("\\boh", "\\bah", "\\baha", "\\bouch", "yuk"),
back_channels = c("uh[- ]huh", "uhuh", "yeah"),
summons = "hey",
justification = "because"
)
b <- presidential_debates_2012 %>%
with(term_count(dialogue, list(person, time), term_list))
combine_counts(a, b)
combine_counts(b, a)
d <- sam_i_am %>%
term_count(TRUE, token_list[1:2])
e <- sam_i_am %>%
term_count(TRUE, token_list[[3]])
combine_counts(e, d)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.