auto_crosstab_to_wb: Take a cross tabulation produced by 'reshape2::dcast' and...

Description Usage Arguments Examples

Description

Take a cross tabulation produced by reshape2::dcast and output a formatted openxlsx wb object

Usage

1
2
3
4
5
6
7
8
auto_crosstab_to_wb(df, auto_number_format = TRUE, top_headers = NULL,
  titles = NULL, footers = NULL, auto_open = FALSE, indent = TRUE,
  left_header_colnames = NULL, vertical_border = TRUE, return_tab = FALSE,
  auto_merge = TRUE, insert_below_tab = NULL, total_text = NULL,
  include_header_rows = TRUE, wb = NULL, ws_name = NULL,
  number_format_overrides = list(), fill_non_values_with = list(na = NULL,
  nan = NULL, inf = NULL, neg_inf = NULL), allcount_to_level_translate = NULL,
  left_header_col_widths = NULL, body_header_col_widths = NULL)

Arguments

df

A data.frame. The cross tabulation to convert to Excel

auto_number_format

Whether to automatically detect number format

top_headers

A list. Custom top headers. See add_top_headers()

titles

The title. A character vector. One element per row of title

footers

Table footers. A character vector. One element per row of footer.

auto_open

Boolean. Automatically open Excel output.

indent

Automatically detect level of indentation of each row

left_header_colnames

The names of the columns that you want to designate as left headers

vertical_border

Boolean. Do you want a left border?

return_tab

Boolean. Return a tab object rather than a openxlsx workbook object

auto_merge

Boolean. Whether to merge cells in the title and footers to width of body

insert_below_tab

A existing tab object. If provided, this table will be written on the same sheet, below the provided tab.

total_text

The text that is used for the 'grand total' of a cross tabulation

include_header_rows

Boolean - whether to include or omit the header rows

wb

A existing openxlsx workbook. If not provided, a new one will be created

ws_name

The name of the worksheet you want to write to

number_format_overrides

e.g. list("colname1" = "currency1") see auto_style_number_formatting

fill_non_values_with

Manually specify a list of strings that will replace non numbers types NA, NaN, Inf and -Inf. e.g. list(na = '*', nan = ”, inf = '-', neg_inf = '–'). Note: NaNs are not treated as NAs.

allcount_to_level_translate

Manually specify how to translate summary levels into header formatting

left_header_col_widths

Width of row header columns you wish to set in Excel column width units. If singular, value is applied to all row header columns. If a vector, vector must have length equal to the number of row headers in workbook. Use special case "auto" for automatic sizing. Default (NULL) leaves column widths unchanged.

body_header_col_widths

Width of body header columns you wish to set in Excel column width units. If singular, value is applied to all body columns. If a vector, vector must have length equal to the number of body headers in workbook. Use special case "auto" for automatic sizing. Default (NULL) leaves column widths unchanged.

Examples

1
2
crosstab <- read.csv(system.file("extdata", "example_crosstab.csv", package="xltabr"))
wb <- auto_crosstab_to_wb(crosstab)

moj-analytical-services/xltabr documentation built on May 9, 2019, 9:59 p.m.