nperc_tbl_MATA.Rd
`nperc_tbl_MATA` can be used to create a table showing the n counts and percentages for each option in a mark all that apply question.
nperc_tbl_MATA(df, vars, value, row.names = NULL, punc = NULL, plot = FALSE)
A data frame used to create the table.
A vector of variable names to include in the table (all vars have to be dichotomus). Input the desired variables as if you were selecting variables using dplyr's `select()` function.
The value in the rows of `vars` (only one value across all variables).
The name of each row in the table. Should be equivalent to each option in the select all that apply question.
The punctuation at the end of the row names.
If TRUE, returns a count and percent bar plot instead of a data frame. Defaults to FALSE.
A frequency table
# Table
nperc_tbl_MATA(df = bns2_pkg_data,
vars = c(q14_1:q14_4),
value = "Yes",
row.names = c("I am a broke college student",
"No good restaurants",
"I like cooking"),
punc = ".")
#> # A tibble: 3 × 2
#> col npct
#> <chr> <chr>
#> 1 I am a broke college student. (n = 47) 33 (70.2%)
#> 2 No good restaurants. (n = 47) 20 (42.6%)
#> 3 I like cooking. (n = 46) 3 (6.5%)
# Barplot
nperc_tbl_MATA(df = bns2_pkg_data,
vars = c(q14_1:q14_4),
value = "Yes",
plot = TRUE)