Description Usage Arguments Value Examples
View source: R/select_counts.R
Apply normalization to a term count columns of termco
object without
stripping the class & attributes of the object.
1 | select_counts(x, ...)
|
x |
A |
... |
One or more unquoted expressions separated by commas. You can
treat variable names like they are positions. See |
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 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 70 71 72 | ## Not run:
library(dplyr)
term_list <- list(
`if` = c('if'),
ands = c('an'),
or = c('or'),
buts = c('but')
)
out <- presidential_debates_2012 %>%
with(term_count(dialogue, TRUE, term_list))
out
out %>%
select_counts(-or)
out %>%
select_counts(-c(ands:buts))
out %>%
select_counts(n.words, ands:buts)
## Can't print as a term_count object (n n.words)
out %>%
select_counts(ands:buts)
## Token Counts
token_list2 <- 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'),
other = c('in')
),
list(
other = 'i'
)
)
x <- token_count(sam_i_am, grouping.var = TRUE, token.list = token_list2)
x %>%
select_counts(-thing)
x %>%
select_counts(-c(person, other))
## Handles metatags
tag_list <- list(
noun = c('person', 'place', 'thing'),
odd_ones = c('other', 'no_like')
)
x2 <- set_meta_tags(x, tag_list)
x2 %>%
tidy_counts()
x2 %>%
select_counts(-c(person, other))%>%
tidy_counts()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.