write_redcap_xlsx {REDCapTidieR} | R Documentation |
Write Supertibbles to XLSX
Description
Transform a supertibble into an XLSX file, with each REDCap data tibble in a separate sheet.
Usage
write_redcap_xlsx(
supertbl,
file,
add_labelled_column_headers = NULL,
use_labels_for_sheet_names = TRUE,
include_toc_sheet = TRUE,
include_metadata_sheet = TRUE,
table_style = "tableStyleLight8",
column_width = "auto",
recode_logical = TRUE,
na_replace = "",
overwrite = FALSE
)
Arguments
supertbl |
A supertibble generated using |
file |
The name of the file to which the output will be written. |
add_labelled_column_headers |
If |
use_labels_for_sheet_names |
If |
include_toc_sheet |
If |
include_metadata_sheet |
If |
table_style |
Any Excel table style name or "none". For more details, see
the
"formatting" vignette
of the |
column_width |
Sets the width of columns throughout the workbook. The default is "auto", but you can specify a numeric value. |
recode_logical |
If |
na_replace |
The value used to replace |
overwrite |
If |
Value
An openxlsx2
workbook object, invisibly
Examples
## Not run:
redcap_uri <- Sys.getenv("REDCAP_URI")
token <- Sys.getenv("REDCAP_TOKEN")
supertbl <- read_redcap(redcap_uri, token)
supertbl %>%
write_redcap_xlsx(file = "supertibble.xlsx")
# Add variable labels
library(labelled)
supertbl %>%
make_labelled() %>%
write_redcap_xlsx(file = "supertibble.xlsx", add_labelled_column_headers = TRUE)
## End(Not run)