saveAsExcel
will save one or more grids in an Excel file (.xlsx
).
Arguments
- x
A
repgrid
object or a list of grids.- file
File path. Suffix must be
.xlsx
.- 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
# save one grid in wide format (default)
file <- tempfile(fileext = ".xlsx")
saveAsExcel(boeker, file)
if (FALSE) { # \dontrun{
browseURL(file) # open file, requires Excel, may not work on all system
} # }
# save one grid in log format
file <- tempfile(fileext = ".xlsx")
saveAsExcel(boeker, file, format = "long")
if (FALSE) { # \dontrun{
browseURL(file)
} # }
# save a list of grids
file <- tempfile(fileext = ".xlsx")
l <- list(boeker, feixas2004, bell2010)
saveAsExcel(l, file)
if (FALSE) { # \dontrun{
browseURL(file)
} # }
# pass some sheet names (2nd with named sheet)
file <- tempfile(fileext = ".xlsx")
l <- list(boeker, "feixas' grid" = feixas2004)
saveAsExcel(l, file)
if (FALSE) { # \dontrun{
browseURL(file)
} # }