write_custom_xlsx: Write Custom Excel

View source: R/write_custom_xlsx.R

write_custom_xlsxR Documentation

Write Custom Excel

Description

My custom wrapper around openxlsx::write.xlsx().

Usage

write_custom_xlsx(
  x,
  file,
  asTable = FALSE,
  borders = "columns",
  keepNA = FALSE,
  colWidths_auto = TRUE,
  freeze_firstRow = FALSE,
  freeze_firstCol = FALSE,
  head_text = "bold",
  head_fgfill = "#d9ead3",
  head_border = "TopBottomLeftRight",
  head_halign = "center",
  head_valign = "center",
  return_wb = TRUE,
  ...
)

Arguments

x

Object or a list of objects that can be handled by openxlsx::writeData to write to file

file

file name in .xlsx

asTable

Write using openxlsx::writeDataTable() as opposed to openxlsx::writeData()

borders

Cell borders, Either "surrounding", "columns" or "rows" or NULL. If "surrounding", a border is drawn around the data. If "rows", a surrounding border is drawn a border around each row. If "columns", a surrounding border is drawn with a border between each column. If "all" all cell borders are drawn

keepNA

If TRUE, NA values are converted to #N/A (or na.string, if not NULL) in Excel, else NA cells will be empty. Defaults to FALSE.

colWidths_auto

If TRUE, automatically adjust the column widths.

freeze_firstRow

If TRUE, freezes the first row (equivalent to firstActiveRow = 2)

freeze_firstCol

If TRUE, freezes the first column (equivalent to firstActiveCol = 2)

head_text

Header text styling - one of "bold", "strikeout", "italic", "underline", "underline2" (passed to openxlsx::createStyle)

head_fgfill

Header cell foreground fill colour. (passed to openxlsx::createStyle)

head_border

Header Cell border. A vector of "top", "bottom", "left", "right" or a single string). (passed to openxlsx::createStyle)

head_halign

Header Horizontal alignment of cell contents (passed to openxlsx::createStyle)

head_valign

Header Vertical alignment of cell contents (passed to openxlsx::createStyle)

return_wb

If TRUE Return workbook object.

...

to openxlsx::write.xlsx()

Value

Input Data x or workbook object

Examples

## Not run: 
write_custom_xlsx(list(a = iris, b = mtcars), "my_analysis.xlsx")

## End(Not run)

Lightbridge-KS/lbdoc documentation built on May 16, 2024, 3:03 p.m.