mtcars %>%
tabyl(am, cyl) %>%
adorn_percentages("col")
# calculates correctly even with totals column and/or row:
mtcars %>%
tabyl(am, cyl) %>%
adorn_totals("row") %>%
adorn_percentages()
# Control the columns to be adorned with the ... variable selection argument
# If using only the ... argument, you can use empty commas as shorthand
# to supply the default values to the preceding arguments:
cases <- data.frame(
region = c("East", "West"),
year = 2015,
recovered = c(125, 87),
died = c(13, 12)
)
cases %>%
adorn_percentages(,,recovered:died)
Run the code above in your browser using DataLab