View source: R/MakeCountTables.R
MakeCountTables | R Documentation |
Takes an input table and calculates the total and percentages for each variable. In order to ensure one row per observation, a id_var parameter is required.
MakeCountTables(data, id_var = NULL, group_var = NULL, rm_na = FALSE, sum_vars)
data |
the input table |
id_var |
the row-identifier column |
group_var |
the parameter to group the counts and percentages by |
sum_vars |
a vector of variables from the table to perform the operation on |
## Note: must provide either an id_var or a group_var. # N(%)s with a grouping variable out <- MakeCountTables(data, id_var="MRN", group_var="Included_in_Study", sum_vars=c("Etiology", "Race", "Gender")) print(out$Etiology) # N(%s) without a grouping variable out <- MakeCountTables(data, id_var="MRN", sum_vars=c("Etiology", "Race", "Gender")) print(out$Etiology)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.