Skip to contents

Creates a summary table of counts and percentages from a data frame pre-processed with the dataSumm() and returns a flextable object.

Usage

tblSumm(df, totals = TRUE)

Arguments

df

a tibble or data frame pre-processed with the dataSumm() so that it has a summary that includes 5 columns: item, response, n_answers, percent_answers and percent_answers_label. Item is the name of the original item, Response is all of the categorical responses possible for the item. n_answers is the count of each response, percent_answers is the percentage of each response and percent_answers_label is a character variable of percentage labelled with percent sign for use as a label.

totals

If true, returns a summary table with a last row of totals, if false, does not have a final row of totals. Set True by default.

Value

a flextable object with the 3 columns, response, counts and percentages, Colors are set to The Mark USA branding

Examples

data <- dplyr::tibble(
  role = c(
    "Faculty", "Postdoc", "Undergraduate student", "Graduate student",
    "Graduate student", "Postdoc", "Postdoc", "Faculty",
    "Faculty", "Graduate student", "Graduate student", "Postdoc",
    "Faculty", "Faculty", "Faculty", "Faculty", "Faculty", "Graduate student",
    "Undergraduate student", "Undergraduate student"
  )
)

role_summ <- data %>%
  dplyr::select(role) %>%
  TheMarkUSA::dataSumm()

role_summ %>% tblSumm()

Response

Percent

Count

Faculty

40%

8

Graduate student

25%

5

Postdoc

20%

4

Undergraduate student

15%

3

Total

-

20