This function is a light wrapper to perform these steps
from the very useful openxlsx R package:
Usage
set_xlsx_rowheights(
xlsxFile,
sheet = 1,
rows = seq_along(heights) + 1,
heights = 17,
...
)Arguments
- xlsxFile
characterfilename to a file with ".xlsx" extension, orWorkbookobject defined in theopenxlsxpackage. WhenxlsxFileis aWorkbookthe output is not saved to a file.- sheet
integersheet number orcharactersheet name, passed toopenxlsx::setRowHeights()indicating the worksheet to affect.- rows
integer vectorindicating the row numbers to affect.- heights
numeric vectorindicating the height of each column defined byrows.- ...
additional arguments are passed to
openxlsx::setRowHeights().
Value
Workbook object as defined by the openxlsx package
is returned invisibly with invisible(). This Workbook
can be used in argument wb to provide a speed boost when
saving multiple sheets to the same file.
Details
Note that when only the argument heights is defined,
the argument rows will point to row 2 and lower, thus
skipping the first (header) row. Define rows specifically
in order to affect the header row as well.
See also
Other jam export functions:
applyXlsxCategoricalFormat(),
applyXlsxConditionalFormat(),
readOpenxlsx(),
set_xlsx_colwidths(),
writeOpenxlsx()
Examples
# write to tempfile for examples
if (check_pkg_installed("openxlsx")) {
out_xlsx <- tempfile(pattern="writeOpenxlsx_", fileext=".xlsx")
df <- data.frame(a=LETTERS[1:5], b=1:5);
writeOpenxlsx(x=df,
file=out_xlsx,
sheetName="jamba_test");
## by default, rows will start at row 2, skipping the header
set_xlsx_rowheights(out_xlsx,
sheet="jamba_test",
heights=rep(17, nrow(df))
)
## to include the header row
set_xlsx_rowheights(out_xlsx,
sheet="jamba_test",
rows=seq_len(nrow(df)+1),
heights=rep(17, nrow(df)+1)
)
}