perc_number | R Documentation |
Helper function to create summary statistics of ordinal or categorical variables, for use in a summary table. It will display the occurrence of a condition within an ordinal or categorical variable. Works best with two groups.
perc_number(var, count.condition, n.digits = 1, na.rm = TRUE)
var |
character of factor vector |
count.condition |
character string. Variable to group by |
n.digits |
number of digits to use in output |
na.rm |
logical, indicating whether NA values should be excluded |
Character string
groupvar <- sample(c("Men", "Women"), 80, TRUE)
perc_number(groupvar, count.condition = "Men")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.