aboutsummaryrefslogtreecommitdiff
path: root/R/mkinfit.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/mkinfit.R')
-rw-r--r--R/mkinfit.R6
1 files changed, 5 insertions, 1 deletions
diff --git a/R/mkinfit.R b/R/mkinfit.R
index c851fddb..52053685 100644
--- a/R/mkinfit.R
+++ b/R/mkinfit.R
@@ -21,7 +21,8 @@ utils::globalVariables(c("name", "time", "value"))
#' "FOMC", "DFOP", "HS", "SFORB", "IORE"). If a shorthand name is given, a
#' parent only degradation model is generated for the variable with the
#' highest value in \code{observed}.
-#' @param observed A dataframe with the observed data. The first column called
+#' @param observed A dataframe or an object coercible to a dataframe
+#' (e.g. a \code{tibble}) with the observed data. The first column called
#' "name" must contain the name of the observed variable for each data point.
#' The second column must contain the times of observation, named "time".
#' The third column must be named "value" and contain the observed values.
@@ -292,6 +293,9 @@ mkinfit <- function(mkinmod, observed,
# Get the names of observed variables
obs_vars <- names(mkinmod$spec)
+ # Coerce observed data to a dataframe
+ observed <- as.data.frame(observed)
+
# Subset observed data with names of observed data in the model and remove NA values
observed <- subset(observed, name %in% obs_vars)
observed <- subset(observed, !is.na(value))

Contact - Imprint