Skip to contents

Extension to the saveRDS function that allows capturing object metadata as a separate .json file.

Usage

save_rds_with_metadata(
  object,
  file = "",
  meta_type = "NA",
  meta_equations = NULL,
  meta_notes = NULL,
  meta_abbrevs = NULL,
  table1_format = F,
  ...
)

Arguments

object

R object to serialize

file

A connection or the name of the file where the R object is saved to or read from

meta_type

The analysis meta type. Defaults to "NA"

meta_equations

Additional equations to add to metadata

meta_notes

Additional notes to add to metadata

meta_abbrevs

Additional abbrevs to add to metadata

table1_format

Boolean for declaring object is table1 format

...

Additional args to be used in saveRDS

Examples

if (FALSE) { # \dontrun{
# Path to the analysis tables (.RDS) and metadata (.json files)
tables.path <- file.path(tempdir(), "tables")

# ---------------------------------------------------------------------------
# Save a simple table
# ---------------------------------------------------------------------------

out_name <- "01-12345-pk-theoph.csv"
save_rds_with_metadata(
  object = Theoph,
  file = file.path(tables.path, out_name)
)
} # }