Save a list of outputs

save_outputs(
  outputs,
  outfolder = file.path("output"),
  generic_suffix = NULL,
  save_rds = TRUE,
  verbose_level = 1
)

Arguments

outputs

`list` of outputs as created by `generate_outputs`

outfolder

Folder in which to store the `outputs“

generic_suffix

generic suffix. must be length 1 character or NULL.

save_rds

Should the input `outputs` be saved as `.rds` files in in addition to `.out` or `.pdf` files? Defaults to `FALSE`.

verbose_level

Level of verbose information displayed. Default set to `1`.

Value

The input `object` invisibly

Examples

## As `save_outputs` is the last step in the pipeline we have to run
## the 'whole machinery' in order to show its functionality. Also take a look
## at the `AutoslideR-Demo` repo on code.roche.com.
library(dplyr, warn.conflicts = FALSE)

data <- list(
  adsl = eg_adsl,
  adae = eg_adae,
  adtte = eg_adtte
)

filters::load_filters(
  yaml_file = system.file("filters.yml", package = "autoslider.core"),
  overwrite = TRUE
)

## For this example the outputs will be saved in a temporary directory. In a
## production run this should be the reporting event's 'output' folder instead.
output_dir <- tempdir()

spec_file <- system.file("spec.yml", package = "autoslider.core")
read_spec(spec_file) %>%
  filter_spec(program == "t_dm_slide") %>%
  generate_outputs(datasets = data) %>%
  decorate_outputs() %>%
  save_outputs(outfolder = output_dir)
#>  1/46 outputs matched the filter condition `program == "t_dm_slide"`.
#>  Running program `t_dm_slide` with suffix 'FAS'.
#> Filter 'FAS' matched target ADSL.
#>  Error: object 'FASFL' not found
#>  Saving output t_dm_slide_FAS failed in step filter dataset with error message: object 'FASFL' not found
#>  Total number of success 0/1
#>  Total number of failures 1/1
#> $t_dm_slide_FAS
#> [1] "object 'FASFL' not found"
#> attr(,"step")
#> [1] "filter dataset"
#> attr(,"spec")
#> attr(,"spec")$program
#> [1] "t_dm_slide"
#> 
#> attr(,"spec")$titles
#> [1] "Patient Demographics and Baseline Characteristics"
#> 
#> attr(,"spec")$footnotes
#> [1] "t_dm_slide footnote"
#> 
#> attr(,"spec")$paper
#> [1] "L6"
#> 
#> attr(,"spec")$suffix
#> [1] "FAS"
#> 
#> attr(,"spec")$args
#> attr(,"spec")$args$arm
#> [1] "TRT01A"
#> 
#> attr(,"spec")$args$vars
#> [1] "SEX"     "AGE"     "RACE"    "ETHNIC"  "COUNTRY"
#> 
#> 
#> attr(,"spec")$output
#> [1] "t_dm_slide_FAS"
#> 
#> attr(,"class")
#> [1] "autoslider_error"
#> attr(,"outpath")
#> [1] "/tmp/Rtmpf9VSFS/t_dm_slide_FAS.pdf"
#>