aboutsummaryrefslogtreecommitdiff
path: root/R/CAKE_export.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-03-19 05:51:10 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-03-19 05:51:10 +0100
commitd03a6abad27d6eef13dceb64f31b1278bb816c00 (patch)
treeedb0d2ae49ce3e74167616305bab494ba7670fc1 /R/CAKE_export.R
parente48c1f2ef990a622722e416c8d301430db4f5081 (diff)
Improvements to CAKE_export()
Diffstat (limited to 'R/CAKE_export.R')
-rw-r--r--R/CAKE_export.R11
1 files changed, 8 insertions, 3 deletions
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))

Contact - Imprint