Function to export data from R to a formatted .xlsx-file. The data is exported to the first sheet. Metadata information is exported to the second sheet.
aXLSX(
file,
data,
title = NULL,
source = NULL,
metadata = NULL,
grouplines = NULL,
group_names = NULL,
logo = NA,
contactdetails = NA,
homepage = NA,
author = "user",
config = "default"
)
file name of the xlsx-file. The extension ".xlsx" is added
data to be included.
title to be put above the data.
source of the data. Default can be adjusted via user profiles
metadata information to be included. Defaults to NA, meaning no metadata are attached.
Can be used to visually group variables. Values should either correspond to numeric column indices or column names, denoting the first variable in a group. Defaults to NA, meaning no lines are added.
A vector of names for groups to be displayed in a secondary header. Should be of the same length as grouplines, and cannot be used unless these are set. Defaults to NA, meaning no secondary header is created.
File path to the logo to be included in the index-sheet. Defaults to the logo of the Statistical Office of Kanton Zurich. This can either be overridden with a path to an image file, or configured in a user profile.
Character vector with contact information to be displayed
on the title sheet. By default uses inputHelperContactInfo()
to
construct it based on values defined in the active user configuration.
Homepage of data publisher. Default can be adjusted via user configuration.
defaults to the last two letters (initials) or numbers of the internal user name.
which config file should be used. Default: default
This function is well-suited for applications where a single dataset needs to be accompanied by a second sheet with explanations or other complex metadata.
if (FALSE) {
aXLSX(file = tempfile(fileext = ".xlsx"),
data = mtcars,
title = "Motor trend car road tests",
source = paste("Source: Henderson and Velleman (1981). Building",
"multiple regression models interactively.",
"Biometrics, 37, 391–411."),
metadata = paste("The data was extracted from the 1974",
"Motor Trend US magazine and comprises fuel",
"consumption and 10 aspects of automobile design",
"and performance for 32 automobiles",
"(1973–74 models)."))
}