Description Usage Arguments Examples
This function gives you a simple count with percentages that is weighted
1 |
df |
Name of the Dataset |
var |
Variable to Count |
wt |
Weighting Variable |
cum |
Will add a cumulative total if set to TRUE |
show_na |
Will remove the NAs before the calculation if set to TRUE, defaults to FALSE |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | cces <- read_csv("https://raw.githubusercontent.com/ryanburge/blocks/master/cces.csv")
cces %>%
ct(race)
# With a weight
cces %>%
ct(race, wt = commonweight_vv)
cces %>%
mutate(race2 = frcode(race == 1 ~ "White",
race == 2 ~ "Black",
race == 3 ~ "Hispanic",
race == 4 ~ "Asian")) %>%
ct(race2, show_na = FALSE, commonweight_vv)
# Cumulative Counts
cces %>%
ct(race, cum = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.