Calculates percentage of cases for provided variable and criteria specified in subset argument. Function accepts numeric, factor and logical variables for x parameter. If numeric and/or factor is provided, subsetting can be achieved via subset argument. Depending on value of na.rm argument, either valid (na.rm = TRUE) or all cases (na.rm = FALSE) are taken into account. By passing logical variable to x, a sum of (TRUE) elements is calculated instead, and valid percents are used (NA are excluded).
percent(x, subset = NULL, na.rm = TRUE, pct = FALSE, ...)a numeric variable to be summarised
an expression that evaluates to logical vector (defaults to NULL)
should missing values be
print percent string too?
additional arguments for pct function
a numeric or string depending on the value of pct