
Write technology object(s) to an Excel workbook
Source: R/xlsx-technology.R
write_technology_xlsx.RdSerialises one or more technology objects to a .xlsx file, one technology
per worksheet. Each slot of the class is written as a labelled mini-table
whose header row matches the columns of the corresponding data.frame slot
(names(slot(tech, s))). Scalar slots (name, desc, cap2act, region,
timeframe, fullYear, optimizeRetirement, misc) are written into a
leading meta block. The workbook can be read back with
read_technology_xlsx().
Usage
write_technology_xlsx(
x,
path,
include_empty = TRUE,
drop_empty_cols = FALSE,
header_fill = "#DDEBF7",
info = TRUE,
overwrite = TRUE
)Arguments
- x
A
technologyobject, a (named) list oftechnologyobjects, or arepository(itstechnologymembers are written).- path
Path to the output
.xlsxfile.- include_empty
Logical; if
TRUE(default) every data.frame slot is written, including empty ones (header only) so the full class structure is visible and the file can serve as an editable template. IfFALSE, only slots with at least one row are written.- drop_empty_cols
Logical; if
TRUE, columns that are entirely empty (allNA) within a populated slot's mini-table are dropped, so only columns that carry data are written. Empty slots (no rows) keep their full header. DefaultFALSE. Round-trips safely: missing columns are restored from the class prototype on read.- header_fill
Header-row background colour (hex string, e.g.
"#DDEBF7"). Set toNAorNULLto disable the fill (headers stay bold). Default"#DDEBF7"(light blue).- info
Logical; if
TRUE(default) a leadingInfoworksheet is added documenting every slot and column of thetechnologyclass (names, types and descriptions, taken from the class documentation).read_technology_xlsx()ignores this sheet.- overwrite
Logical; overwrite
pathif it exists (defaultTRUE).
See also
Other technology process:
newTechnology(),
read_technology_xlsx()