View source: R/tidy_specificities.R
tidy_specificities | R Documentation |
Returns a tibble with specificities according to two crossed categories.
tidy_specificities(mydf, cat1, cat2, top_spec = NA, min_spec = NA)
mydf |
a tibble |
cat1 |
a factor corresponding to words or lemmas |
cat2 |
a category |
top_spec |
how many items by category (filter based on specificity) should be kept. If not provided (the default) everything is kept. |
min_spec |
which is the minimum specificity for an item to be kept. If not provided (the default) everything is kept. |
tibble with additional columns cat1, cat2, spec
mydf=dplyr::bind_rows(
tibble::tibble(txt=janeaustenr::prideprejudice,
novel="Pride and Prejudice"),
tibble::tibble(txt=janeaustenr::sensesensibility,
novel="Sense and Sensibility")) %>%
tidytext::unnest_tokens(word,txt)
tidy_specificities(mydf,
cat1=word,
cat2=novel)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.