count_percent.RdThis function computes the counts and percentages for each level of a factor or categorical variable. It returns a character vector with each level's count and its percentage of the total, formatted to a specified number of decimal places.
count_percent(x, digits = 2)A character vector where each element corresponds to a level of x.
Each element is formatted as 'count (percentage%)', where 'count' is the number of occurrences of the level
and 'percentage' is the percentage of the total, rounded to digits decimal places.