diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-09 11:30:52 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-05-09 11:30:52 +0200 |
commit | 47ef00e3d0a961f8fbecf0bd5da0283bed21bb96 (patch) | |
tree | 71c0728f928360d0cc4fb886afdf4c22b0e38121 | |
parent | 7b9f11562fa9ab8a023f47e6b99a2562b668e48c (diff) |
Make mkinpredict consistently return a dataframe
-rw-r--r-- | R/mkinpredict.R | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/R/mkinpredict.R b/R/mkinpredict.R index df51dbe3..8c76ca05 100644 --- a/R/mkinpredict.R +++ b/R/mkinpredict.R @@ -37,7 +37,7 @@ #' solver is used. #' @import deSolve #' @importFrom inline getDynLib -#' @return A matrix in the same format as the output of \code{\link{ode}}. +#' @return A data frame with the solution in wide format #' @author Johannes Ranke #' @examples #' @@ -72,27 +72,27 @@ #' #' # Check compiled model versions - they are faster than the eigenvalue based solutions! #' SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), -#' m1 = list(type = "SFO"), use_of_ff = "min") +#' m1 = list(type = "SFO"), use_of_ff = "max") #' if(require(rbenchmark)) { -#' benchmark( -#' eigen = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), +#' benchmark(replications = 10, order = "relative", columns = c("test", "relative", "elapsed"), +#' eigen = mkinpredict(SFO_SFO, +#' c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), #' c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), #' solution_type = "eigen")[201,], -#' deSolve_compiled = mkinpredict(SFO_SFO, -#' c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), +#' deSolve_compiled = mkinpredict(SFO_SFO, +#' c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), #' c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), #' solution_type = "deSolve")[201,], -#' deSolve = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), -#' c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), -#' solution_type = "deSolve", use_compiled = FALSE)[201,], -#' replications = 10) +#' deSolve = mkinpredict(SFO_SFO, +#' c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), +#' c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), +#' solution_type = "deSolve", use_compiled = FALSE)[201,], +#' analytical = mkinpredict(SFO_SFO, +#' c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), +#' c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), +#' solution_type = "analytical", use_compiled = FALSE)[201,]) #' } #' -#' # Since mkin 0.9.49.11 we also have analytical solutions for some models, including SFO-SFO -#' # deSolve = mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), -#' # c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), -#' # solution_type = "analytical", use_compiled = FALSE)[201,], -#' #' \dontrun{ #' # Predict from a fitted model #' f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE) @@ -209,7 +209,7 @@ mkinpredict.mkinmod <- function(x, } return(out_mapped) } else { - return(out) + return(as.data.frame(out)) } } |