A simple function for exporting data from R to a single formatted .xlsx-spreadsheet.

quickXLSX(
  data,
  file,
  title = NULL,
  source = NULL,
  metadata = NULL,
  grouplines = NULL,
  group_names = NULL,
  logo = NA,
  contactdetails = NA,
  homepage = NA,
  author = "user",
  config = "default"
)

Arguments

data

data to be included.

file

file name of the xlsx-file. The extension ".xlsx" is added

title

title to be put above the data.

source

source of the data. Default can be adjusted via user profiles

metadata

metadata information to be included. Defaults to NA, meaning no metadata are attached.

grouplines

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.

group_names

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.

logo

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.

contactdetails

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

Homepage of data publisher. Default can be adjusted via user configuration.

author

defaults to the last two letters (initials) or numbers of the internal user name.

config

which config file should be used. Default: default

Examples


title <- "Motor trend car road tests"
source <- paste(
  "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).")
if (FALSE) {
quickXLSX(file = tempfile(fileext = ".xlsx"),
          data = mtcars,
          title = title,
          source = source,
          metadata = metadata)
}