| generate_workbook | R Documentation |
Populate an 'openxlsx2' wbWorkbook-class object with content from an
aftable-class object. In turn, the output can be passed to
wb_save from 'openxlsx2'
generate_workbook(
aftable,
author = NULL,
title = NULL,
keywords = NULL,
config_path = "config.yaml",
config_name = NULL
)
aftable |
An aftable-class object created using
|
author |
Optional character string to set the workbook author. Default NULL. |
title |
Optional character string to set the workbook title. Default NULL. |
keywords |
Optional character vector to set the workbook keywords. Default NULL. |
config_path |
Optional character string containing path to config file. Defaults to config.yaml file located in working directory. |
config_name |
Optional character string specifying which configuration to use from config file. Default NULL. |
Analysis Function guidance advises workbooks should have the author, title,
keywords and language document properties completed. aftables provides
functionality to set the author, title and keywords properties.
See Releasing statistics in spreadsheets
for more information including how to set the workbook language.
A config file can be used to set workbook properties and formatting. See
create_config_yaml for details of how to create a
config.yaml file. If author, title or keywords are provided in both the
config.yaml file and in the generate_workbook arguments, the values provided in the
function arguments are preferred to those provided in the config.yaml file.
An openxlsx2 wbWorkbook-class object.
# Convert an aftable to an openxlsx2 wbWorkbook-class object
# Setting the minimum workbook properties as function arguments
## Not run:
example_workbook <- generate_workbook(
demo_aftable,
author = "Example author",
title = "example workbook",
keywords = c("keyword1", "keyword2", "keyword3")
)
## End(Not run)
# Use openxlsx2::wb_get_properties to view properties that have been applied
## Not run:
openxlsx2::wb_get_properties(example_workbook)
## End(Not run)
# Save the workbook with openxlsx2::wb_save
## Not run:
openxlsx2::wb_save(example_workbook, "example_workbook.xlsx")
## End(Not run)
# Using config.yaml file to set workbook properties and edit text and cell
# formatting
## Not run:
example_workbook2 <- generate_workbook(
demo_aftable,
config_path = system.file("ext-data", "config.yaml", package = "aftables"),
config_name = "workbook1"
)
## End(Not run)
# Use openxlsx2::wb_get_properties to view properties that have been applied
## Not run:
openxlsx2::wb_get_properties(example_workbook2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.