From d03a6abad27d6eef13dceb64f31b1278bb816c00 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 19 Mar 2022 05:51:10 +0100 Subject: Improvements to CAKE_export() --- R/CAKE_export.R | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'R') diff --git a/R/CAKE_export.R b/R/CAKE_export.R index 70661b10..b16f186a 100644 --- a/R/CAKE_export.R +++ b/R/CAKE_export.R @@ -28,11 +28,11 @@ CAKE_export <- function(ds, map = c(parent = "Parent"), links = NA, filename = "CAKE_export.csf", path = ".", overwrite = FALSE, - study = "Codlemone aerobic soil degradation", + study = "Degradinol aerobic soil degradation", description = "", time_unit = "days", res_unit = "% AR", - comment = "Created using mkin::CAKE_export", + comment = "", date = Sys.Date(), optimiser = "IRLS") { @@ -41,11 +41,16 @@ CAKE_export <- function(ds, map = c(parent = "Parent"), csf <- file(file, encoding = "latin1", open = "w+") on.exit(close(csf)) + CAKE_compartments = c("Parent", "A1", "A2", "A3", "B1", "B2", "C1") + if (!all(map %in% CAKE_compartments)) { + stop("The elements of map have to be CAKE compartment names") + } + add <- function(x) cat(paste0(x, "\r\n"), file = csf, append = TRUE) add0 <- function(x) cat(x, file = csf, append = TRUE) add("[FileInfo]") - add("CAKE-Version: 3.3 (Release)") + add("CAKE-Version: 3.4 (Release)") add(paste("Name:", study)) add(paste("Description:", description)) add(paste("MeasurementUnits:", res_unit)) -- cgit v1.2.1