Description Usage Arguments Value Examples
View source: R/collapse_tags.R
Collapse (sum) tags/columns of a term_count
object or remove columns
without changing termco class.
1 | collapse_tags(x, mapping, ...)
|
x |
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. Setting
a column name to |
... |
ignored. |
Returns a term_count
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 | mapping <- list(
babbling = c('response_cries', 'back_channels'), #combines these columns
NULL = 'justification' #remove this column(s)
)
data(markers); markers
collapse_tags(markers, mapping)
## Token Counts
token_list <- list(
list(
noun__w1.person = c('sam', 'i')
),
list(
noun__w2.place = c('here', 'house'),
noun__w3.thing = c('boat', 'fox', 'rain', 'mouse', 'box', 'eggs', 'ham')
),
list(
negative__w1.no_like = c('not like'),
noun__w3.thing = c('train', 'goat')
),
list(
other__w1.other = '^.*$'
)
)
x <- token_count(sam_i_am, grouping.var = TRUE, token.list = token_list,
meta.sep = c('__', '.'))
## drops metatags attribute
## Not run:
collapse_tags(x, list(ccc = c('noun__w1.person', 'noun__w2.place')))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.