writeExcel produces publication-quality Excel reports: Toplines (one-way frequency tables) or Banners (cross tabulations)

writeExcel(
  data_summary,
  filename = getName(data_summary),
  wb = NULL,
  theme = themeDefaultExcel(),
  title = getName(data_summary),
  subtitle = NULL,
  table_of_contents = FALSE,
  n_or_percent = c("percents", "counts"),
  hypothesis_test = FALSE,
  logging = FALSE,
  save_workbook = TRUE
)

Arguments

data_summary

An object of class Toplines or Crosstabs.

filename

character. The name of the output file.

wb

An openxlsx Workbook object to add to. Useful for custom front pages.

theme

An object of class Theme.

title

character. An optional title. Defaults to the title provided in the summary.

subtitle

character. An optional subtitle. Defaults to an empty string.

table_of_contents

logical. Should a list of tables be included at the start of the report. Defaults to FALSE.

n_or_percent

character vector. Should the data be returned as counts or percents? Valid values are 'counts', 'percents' or both.

hypothesis_test

logical. Should hypothesis testing be shown in the tabs? ** Not yet implemented. Defaults to FALSE.

logging

logical. Should basic information related to the function execution be printed? Defaults to FALSE.

save_workbook

logical. Should the Workbook be saved to an excel file or returned for the user to continue editing? Defaults to TRUE.

Value

If save_workbook is set to FALSE, the openxlsx Workbook object is returned allowing the user to continue editing it before saving. Otherwise the data is returned as it was provided.

Examples

if (FALSE) { # toplines report toplines_summary <- crosstabs(crunch_dataset, weight = "weight") writeExcel(toplines_summary, "filename") # crosstabs report crosstabs_summary <- crosstabs(crunch_dataset, banner = banner_object) writeExcel(crosstabs_summary, "filename") }