Description Usage Arguments Value Examples
term_before
- View the frequency of terms before a regex/term.
term_after
- View the frequency of terms after a regex/term.
term_first
- View the frequency of terms starting each string.
1 2 3 4 5 | term_before(text.var, term, ignore.case = TRUE, ...)
term_after(text.var, term, ignore.case = TRUE, ...)
term_first(text.var, ignore.case = TRUE, ...)
|
text.var |
The text string variable. |
term |
A regex term to provide the search position. |
ignore.case |
logical. If |
... |
ignored. |
Returns a data.frame of terms and frequencies
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | term_before(presidential_debates_2012$dialogue, 'president')
term_after(presidential_debates_2012$dialogue, 'president')
term_after(presidential_debates_2012$dialogue, 'oil')
term_first(presidential_debates_2012$dialogue)
x <- term_before(presidential_debates_2012$dialogue, 'president')
plot(x)
## Not run:
library(dplyr); library(lexicon)
pos_df_pronouns[['pronoun']][1:5] %>%
lapply(function(x){
term_after(presidential_debates_2012$dialogue, paste0("\\b", x, "\\b"))
}) %>%
setNames(pos_df_pronouns[['pronoun']][1:5])
term_first(presidential_debates_2012$dialogue) %>%
filter(!term %in% tolower(sw_dolch) & !grepl("'", term))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.