aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-05-15 14:04:49 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-05-15 14:04:49 +0200
commitffc12f79fdb283bc59f073208c883b84271be121 (patch)
treea22b49971aa1a466421412aa8bbce9aa117afe53
parent6c65cba39dbca98caf3f8e69552b3454ec1721fc (diff)
Make mkinmod quiet in tests
-rw-r--r--R/mkinmod.R8
-rw-r--r--man/mkinmod.Rd5
-rw-r--r--tests/testthat/test_FOCUS_D_UBA_expertise.R4
-rw-r--r--tests/testthat/test_FOCUS_chi2_error_level.R2
-rw-r--r--tests/testthat/test_mkinpredict_SFO_SFO.R4
-rw-r--r--tests/testthat/test_schaefer07_complex_case.R2
-rw-r--r--tests/testthat/test_synthetic_data_for_UBA_2014.R4
7 files changed, 16 insertions, 13 deletions
diff --git a/R/mkinmod.R b/R/mkinmod.R
index 149d2beb..e865fa27 100644
--- a/R/mkinmod.R
+++ b/R/mkinmod.R
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/> }}}
-mkinmod <- function(..., use_of_ff = "min", speclist = NULL)
+mkinmod <- function(..., use_of_ff = "min", speclist = NULL, quiet = FALSE)
{
if (is.null(speclist)) spec <- list(...)
else spec <- speclist
@@ -272,8 +272,8 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL)
model$coefmat <- m
}#}}}
- # Create a function compiled from C code if possible #{{{
- if (requireNamespace("ccSolve", quietly = TRUE)) {
+ # Create a function compiled from C code if more than one observed variable and ccSolve is available #{{{
+ if (length(obs_vars) > 1 & requireNamespace("ccSolve", quietly = TRUE)) {
diffs.C <- paste(diffs, collapse = ";\n")
diffs.C <- paste0(diffs.C, ";")
for (i in seq_along(diffs)) {
@@ -297,7 +297,7 @@ mkinmod <- function(..., use_of_ff = "min", speclist = NULL)
}
if (sum(sapply(spec, function(x) x$type %in%
c("SFO", "FOMC", "DFOP", "SFORB"))) == length(spec)) {
- message("Compiling differential equation model from auto-generated C code...")
+ if (!quiet) message("Compiling differential equation model from auto-generated C code...")
model$compiled <- ccSolve::compile.ode(diffs.C, language = "C",
parms = parms,
declaration = "double time = *t;")
diff --git a/man/mkinmod.Rd b/man/mkinmod.Rd
index f73b78da..4de4c98a 100644
--- a/man/mkinmod.Rd
+++ b/man/mkinmod.Rd
@@ -13,7 +13,7 @@
in the FOCUS and NAFTA guidance documents are used.
}
\usage{
-mkinmod(..., use_of_ff = "min", speclist = NULL)
+mkinmod(..., use_of_ff = "min", speclist = NULL, quiet = FALSE)
}
\arguments{
\item{...}{
@@ -42,6 +42,9 @@ mkinmod(..., use_of_ff = "min", speclist = NULL)
The specification of the observed variables and their submodel types and
pathways can be given as a single list using this argument. Default is NULL.
}
+ \item{quiet}{
+ Should messages be suppressed?
+ }
}
\value{
A list of class \code{mkinmod} for use with \code{\link{mkinfit}}, containing
diff --git a/tests/testthat/test_FOCUS_D_UBA_expertise.R b/tests/testthat/test_FOCUS_D_UBA_expertise.R
index ce1e0a5a..b12834e5 100644
--- a/tests/testthat/test_FOCUS_D_UBA_expertise.R
+++ b/tests/testthat/test_FOCUS_D_UBA_expertise.R
@@ -19,10 +19,10 @@
context("Results for FOCUS D established in expertise for UBA (Ranke 2014)")
SFO_SFO <- mkinmod(parent = list(type = "SFO", to = "m1"),
- m1 = list(type = "SFO"))
+ m1 = list(type = "SFO"), quiet = TRUE)
SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"),
m1 = list(type = "SFO"),
- use_of_ff = "max")
+ use_of_ff = "max", quiet = TRUE)
fit.default <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
diff --git a/tests/testthat/test_FOCUS_chi2_error_level.R b/tests/testthat/test_FOCUS_chi2_error_level.R
index 65e1ada7..2db2f4e6 100644
--- a/tests/testthat/test_FOCUS_chi2_error_level.R
+++ b/tests/testthat/test_FOCUS_chi2_error_level.R
@@ -22,7 +22,7 @@ context("Calculation of FOCUS chi2 error levels")
SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"),
m1 = list(type = "SFO"),
- use_of_ff = "max")
+ use_of_ff = "max", quiet = TRUE)
test_that("Chi2 error levels for FOCUS D are as in mkin 0.9-33", {
diff --git a/tests/testthat/test_mkinpredict_SFO_SFO.R b/tests/testthat/test_mkinpredict_SFO_SFO.R
index 1238bb28..b7004f64 100644
--- a/tests/testthat/test_mkinpredict_SFO_SFO.R
+++ b/tests/testthat/test_mkinpredict_SFO_SFO.R
@@ -28,9 +28,9 @@ test_that("Variants of model predictions for SFO_SFO model give equivalent resul
# and relative tolerance is thus not met
tol = 0.01
SFO_SFO.1 <- mkinmod(parent = list(type = "SFO", to = "m1"),
- m1 = list(type = "SFO"), use_of_ff = "min")
+ m1 = list(type = "SFO"), use_of_ff = "min", quiet = TRUE)
SFO_SFO.2 <- mkinmod(parent = list(type = "SFO", to = "m1"),
- m1 = list(type = "SFO"), use_of_ff = "max")
+ m1 = list(type = "SFO"), use_of_ff = "max", quiet = TRUE)
ot = seq(0, 100, by = 1)
r.1.e <- subset(mkinpredict(SFO_SFO.1,
diff --git a/tests/testthat/test_schaefer07_complex_case.R b/tests/testthat/test_schaefer07_complex_case.R
index 1ef5106e..1b51e5d2 100644
--- a/tests/testthat/test_schaefer07_complex_case.R
+++ b/tests/testthat/test_schaefer07_complex_case.R
@@ -25,7 +25,7 @@ schaefer07_complex_model <- mkinmod(
A1 = list(type = "SFO", to = "A2"),
B1 = list(type = "SFO"),
C1 = list(type = "SFO"),
- A2 = list(type = "SFO"), use_of_ff = "max")
+ A2 = list(type = "SFO"), use_of_ff = "max", quiet = TRUE)
schaefer07_long <- mkin_wide_to_long(schaefer07_complex_case, time = "time")
diff --git a/tests/testthat/test_synthetic_data_for_UBA_2014.R b/tests/testthat/test_synthetic_data_for_UBA_2014.R
index 2bf01075..25f841b1 100644
--- a/tests/testthat/test_synthetic_data_for_UBA_2014.R
+++ b/tests/testthat/test_synthetic_data_for_UBA_2014.R
@@ -21,12 +21,12 @@ context("Results for synthetic data established in expertise for UBA (Ranke 2014
m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"),
M1 = list(type = "SFO", to = "M2"),
- M2 = list(type = "SFO"), use_of_ff = "max")
+ M2 = list(type = "SFO"), use_of_ff = "max", quiet = TRUE)
m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2")),
M1 = list(type = "SFO"),
- M2 = list(type = "SFO"), use_of_ff = "max")
+ M2 = list(type = "SFO"), use_of_ff = "max", quiet = TRUE)
fit_SFO_lin_a <- mkinfit(m_synth_SFO_lin,
synthetic_data_for_UBA_2014[[1]]$data,

Contact - Imprint