powered by
count_data returns the number of observations for categorical variables.
count_data
count_data(data, ..., na.rm = TRUE)
A data frame.
One or more unquoted (categorical) column names from the data frame, separated by commas.
Logical. Should missing values (including NaN) be removed?
The data frame can be grouped using dplyr's group_by so that the total of observations will be calculated for each group level.
group_by
# NOT RUN { library(dplyr) # 1 variable count_data(cox, sex) # 2 variables count_data(cox, condition, sex) # 1 variable, 1 group cox %>% group_by(condition) %>% count_data(sex) # }
Run the code above in your browser using DataLab