Description Usage Arguments Value Examples
show_uniq
gets the unique values of a column and their position within that vector, prints them neatly to the console, then returns the original data frame unchanged. It's just a convenience for showing the values in a column without breaking your workflow or train of thought, and is useful for identifying groups for add_grps
.
1 |
.data |
A data frame |
col |
Bare column name of interest |
Original unchanged .data
1 2 3 4 5 6 7 8 9 | # show_uniq makes it easy to see that the values of `ratio` that correspond to
# poverty (ratio of 0 to 0.99)
# are at positions 2:4, and for low-income (ration of 0 to 1.99) are at 2:9
pov_age %>%
dplyr::mutate(age = forcats::as_factor(age)) %>%
dplyr::group_by(name, age) %>%
show_uniq(ratio) %>%
add_grps(list(pov_determined = 1, poverty = 2:4, low_income = 2:9),
group = ratio)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.