as_workbook {tatoo}R Documentation

Convert a Tatoo Table Object to an Excel Workbook

Description

as_workbook() converts Tatoo_table or Tatoo_report objects directly to openxlsx Workbook objects. For information about additional parameters please refer to the documentation of write_worksheet(), for which as_workbook() is just a wrapper. Additional possible function arguments way vary depending on which Tatoo_table you want to export.

save_xlsx() is a wrapper for saving a Tatoo_table directly to an ‘xlsx’ file.

view_xlsx() is another wrapper for viewing a Tatoo_table"s ‘xlsx’ representation in your favorite spreadsheet program (powered by openxlsx::openXL()).

Usage

as_workbook(x, ...)

## Default S3 method:
as_workbook(x, sheet = 1L, ...)

## S3 method for class 'Tatoo_report'
as_workbook(x, ...)

save_xlsx(x, outfile, overwrite = FALSE, ...)

view_xlsx(x, ...)

Arguments

x

A Tatoo_table or Tatoo_report

...

Additional arguments passed on to write_worksheet()

sheet

The worksheet to write to. Can be the worksheet index or name.

outfile

Path to the output file

overwrite

If TRUE, overwrite any existing file.

Value

as_workbook() returns an openxlsx Workbook object.

save_xlsx() returns the path to the saved ‘.xlsx’ (invisibly).

view_xlsx() opens an external program and returns NULL (invisibly).

See Also

Other xlsx exporters: write_worksheet()

Examples

## Not run: 
dat <- data.frame(
  Species = c("setosa", "versicolor", "virginica"),
  length = c(5.01, 5.94, 6.59),
  width = c(3.43, 2.77, 2.97)
)

# Assign metadata to convert dat to a Tagged_table

title(dat) <- "Iris excerpt"
footer(dat) <-  "An example based on the iris dataset"


# Convert to Workbook or save als xlsx

wb <- as_workbook(dat)
save_xlsx(dat, tempfile(fileext = ".xlsx"), overwrite = TRUE)

## End(Not run)


[Package tatoo version 1.1.2 Index]