![]() Use table() from base R if you do not have access to the above packagesĪge_summary % count ( age_cat ) %>% # group and count by gender (produces "n" column) mutate ( # create percent of column - note the denominator percent = scales :: percent ( n / sum ( n ) ) ) # print age_summary # age_cat n percentīelow is a method to calculate proportions within groups. ![]() Use tbl_summary() from gtsummary to produce detailed publication-ready tables.Use summarise() and count() from dplyr for more complex statistics, tidy data frame outputs, or preparing data for ggplot(). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |