This function will take a data frame in R and write it out to csv. It also creates a metadata folder, storing the xpt file along with other useful information.

write_derived(
  .data,
  .spec,
  .file,
  .comment = NULL,
  .subject_col = "ID",
  .prev_file = NULL,
  .compare_from_svn = TRUE,
  .return_base_compare = FALSE,
  .execute_diffs = TRUE
)

Arguments

.data

a data frame

.spec

a yspec object

.file

csv file name to write out to (including path)

.comment

explanation of data

.subject_col

subject column name (defaults to ID)

.prev_file

csv file name of previous version (defaults to .file)

.compare_from_svn

logical. Should the data comparison be done on the latest svn version? (If not, local version is used)

.return_base_compare

logical. Should the two current and previous versions of the datasets be returned?

.execute_diffs

logical. Should the diffs be executed?

Examples

if (FALSE) {
nm_spec <- yspec::ys_load(system.file("derived", "pk.yml", package = "mrgda"))
nm <- readr::read_csv(system.file("derived", "pk.csv", package = "mrgda"), na = ".")
write_derived(.data = nm, .spec = nm_spec, .file = "data/derived/pk.csv")
}