aboutsummaryrefslogtreecommitdiff
path: root/R/mkinds.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2018-11-23 00:29:35 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2018-11-23 00:29:35 +0100
commitb2e3fa2be6a10c29030d04edfdaf7d47d9bddcee (patch)
tree171f9447ce504051f78fcdeabb7395a006fe1467 /R/mkinds.R
parent89b185c58b7a7328d11c70c5afff1e377a69eeef (diff)
Improve initialisation of mkinds
Check in work from the beginning of the week
Diffstat (limited to 'R/mkinds.R')
-rw-r--r--R/mkinds.R23
1 files changed, 13 insertions, 10 deletions
diff --git a/R/mkinds.R b/R/mkinds.R
index 60924c21..bed49be3 100644
--- a/R/mkinds.R
+++ b/R/mkinds.R
@@ -1,4 +1,4 @@
-# Copyright (C) 2015 Johannes Ranke
+# Copyright (C) 2015,2018 Johannes Ranke
# Contact: jranke@uni-bremen.de
# This file is part of the R package mkin
@@ -43,13 +43,16 @@ mkinds <- R6Class("mkinds",
initialize = function(title = "", data, time_unit = NA, unit = NA) {
- self$title = title
- self$sampling_times = sort(unique(data$time))
- self$time_unit = time_unit
- self$observed = unique(data$name)
- self$unit = unit
- self$replicates = max(by(data, list(data$name, data$time), nrow))
- self$data = data
+ self$title <- title
+ self$sampling_times <- sort(unique(data$time))
+ self$time_unit <- time_unit
+ self$observed <- unique(data$name)
+ self$unit <- unit
+ self$replicates <- max(by(data, list(data$name, data$time), nrow))
+ if (is.null(data$override)) data$override <- NA
+ if (is.null(data$err)) data$err <- 1
+ self$data <- data
+
}
)
)
@@ -60,6 +63,6 @@ print.mkinds <- function(x, ...) {
cat("Observed compounds $observed: ", paste(x$observed, collapse = ", "), "\n")
cat("Sampling times $sampling_times: ", paste(x$sampling_times, collapse = ", "), "\n")
cat("With a maximum of ", x$replicates, " replicates\n")
- if (!is.na(x$time_unit)) cat("Time units: ", x$time_units, "\n")
- if (!is.na(x$unit)) cat("Observation units: ", x$units, "\n")
+ if (!is.na(x$time_unit)) cat("Time unit: ", x$time_unit, "\n")
+ if (!is.na(x$unit)) cat("Observation unit: ", x$unit, "\n")
}

Contact - Imprint