reshape2::dcast
and output a formatted openxlsx wb objectTake a cross tabulation produced by reshape2::dcast
and output a formatted openxlsx wb object
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)
A data.frame. The cross tabulation to convert to Excel
Whether to automatically detect number format
A list. Custom top headers. See add_top_headers()
The title. A character vector. One element per row of title
Table footers. A character vector. One element per row of footer.
Boolean. Automatically open Excel output.
Automatically detect level of indentation of each row
The names of the columns that you want to designate as left headers
Boolean. Do you want a left border?
Boolean. Return a tab object rather than a openxlsx workbook object
Boolean. Whether to merge cells in the title and footers to width of body
A existing tab object. If provided, this table will be written on the same sheet, below the provided tab.
The text that is used for the 'grand total' of a cross tabulation
Boolean - whether to include or omit the header rows
A existing openxlsx workbook. If not provided, a new one will be created
The name of the worksheet you want to write to
e.g. list("colname1" = "currency1") see auto_style_number_formatting
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.
Manually specify how to translate summary levels into header formatting
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.
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.
# NOT RUN {
crosstab <- read.csv(system.file("extdata", "example_crosstab.csv", package="xltabr"))
wb <- auto_crosstab_to_wb(crosstab)
# }
Run the code above in your browser using DataLab