View source: R/tab_functions.R
tab_cts | R Documentation |
Tabulate a dataframe's variables' value counts
tab_cts(df, id = "id", include_ids = FALSE)
df |
Dataframe |
id |
Character string of the id variable |
include_ids |
Logical denoting whether a list column |
Dataframe consisting of columns var
, val
& n
containing a tabulation of the counts of variables' values.
df <- tibble::tibble( fbnr = 1:10, sex = haven::labelled(c(2, 1, 2, 1, 1, 2, 2, 1, 2, 1), label = "sex", labels = c(MALES = 1, FEMALES = 2)), age = c(24, 23, 23, 41, 23, 39, 30, 18, 31, 48), marital = haven::labelled( c(1, 7, 2, 6, 4, 5, 3, 8, 4, 2), label = "marital status", labels = c( "single" = 1, "steady relationship" = 2, "living with partner" = 3, "married first time" = 4, "remarried" = 5, "separated" = 6, "divorced" = 7, "widowed" = 8 ) ) ) tab_cts(df, "fbnr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.