Wrapper around the write.csv function. Saves data as .RDS and .RTF and captures analysis relevant metadata in a .json file
write_csv_with_metadata.Rd
Extension to the write.csv function that allows capturing object metadata as a separate .json file.
Usage
write_csv_with_metadata(
object,
file,
meta_type = "NA",
meta_equations = NULL,
meta_notes = NULL,
meta_abbrevs = NULL,
table1_format = F,
...
)
Arguments
- object
The object to be written, preferably a matrix or data frame. If not, it is attempted to coerce object to a data frame
- file
Either a character string naming a file or a connection open for writing. "" indicates output to the console.
- meta_type
The analysis meta type. Defaults to "NA"
- meta_equations
Additional equations for metadata
- meta_notes
Additional notes for metadata
- meta_abbrevs
Additional abbrevs for metadata
- table1_format
Boolean for declaring table is table1 format
- ...
Additional arguments that can be passed to write.csv
Examples
if (FALSE) { # \dontrun{
# Path to the analysis tables (.csv) and metadata (.json files)
tables.path <- "OUTPUTS/tables"
# ---------------------------------------------------------------------------------
# Save a simple table
# ---------------------------------------------------------------------------------
out_name <- "01-12345-pk-theoph.csv"
write_csv_with_metadata(
object = Theoph,
file = file.path(tables.path, out_name), row_names = F
)
} # }