Description Usage Arguments Value Functions Examples
Count the number of rows in each ggconsort cohort
1 2 3 4 5 | cohort_count(.data, ...)
cohort_count_int(.data, ...)
cohort_count_adorn(.data, ..., .label_fn = NULL)
|
.data |
A |
... |
Cohorts to include in the output, can be quoted or unquoted cohort names, or tidyselect helpers such as [tidyselect::starts_with()]. |
.label_fn |
An optional custom function for formatting cohort counts |
A tibble
with cohort name, row number total, and label.
cohort_count
: Returns a tibble with cohort name, row number total
and label.
cohort_count_int
: Returns a named vector with cohort counts.
cohort_count_adorn
: Returns a cohort count in "(n = )" or
other custom format
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | cohorts <- trial_data %>%
cohort_start("Assessed for eligibility") %>%
cohort_define(
consented = .full %>% dplyr::filter(declined != 1),
consented_chemonaive = consented %>% dplyr::filter(prior_chemo != 1)
) %>%
cohort_label(
consented = "Consented",
consented_chemonaive = "Chemotherapy naive"
)
cohorts %>%
cohort_count()
cohorts %>%
cohort_count_adorn()
cohorts %>%
cohort_count_adorn(
starts_with("consented"),
.label_fn = function(cohort, label, count, ...) {
glue::glue("{count} {label} ({cohort})")
}
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.