saveAsWorksheet
will add one or more grids to an a openxlsx
Workbook
object.
Arguments
- x
A
repgrid
object or a list of grids.- wb
A openxlsx
Workbook
object.- format
Two output formats are supported:
wide
(default) where each column represents one element, each row represent one constructs (a common grid representation), andlong
where each row contains an element-construct combination and the corresponding rating value. SeeimportExcel()
for details and examples.- sheet
Vector of sheet names with same length as
x
. IfNULL
(default),default_sheet
is used. Ifx
is a list if grids, a sequential index is appended. For named list entries (ifx
is a list of grids), the name overwrites the default sheet name.- default_sheet
Default sheet name to use if not supplied in
sheet
or via list names ofx
.
Examples
library(openxlsx)
wb <- createWorkbook()
# add grid to worksheet
saveAsWorksheet(boeker, wb, sheet = "boeker")
# add several grids with explicit sheet names
l <- list(bell2010, feixas2004)
saveAsWorksheet(l, wb, sheet = c("Bell 2010", "Feixas 2004"))
# list names are used as sheet names. Without name, the default applies.
l <- list(boeker, "Fransella et al. 2003" = fbb2003)
saveAsWorksheet(l, wb)
# save as Excel file
file <- tempfile(fileext = ".xlsx")
saveWorkbook(wb, file)
if (FALSE) { # \dontrun{
browseURL(file) # may not work on all systems
} # }