- using R Under development (unstable) (2019-12-11 r77556)
- using platform: x86_64-pc-linux-gnu (64-bit)
- using session charset: ISO8859-15
- checking for file 'jmv/DESCRIPTION' ... OK
- checking extension type ... Package
- this is package 'jmv' version '1.0.8'
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking serialization versions ... OK
- checking whether package 'jmv' can be installed ... OK
- checking package directory ... OK
- checking for future file timestamps ... OK
- checking 'build' directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking R files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... OK
- checking whether the package can be loaded with stated dependencies ... OK
- checking whether the package can be unloaded cleanly ... OK
- checking whether the namespace can be loaded with stated dependencies ... OK
- checking whether the namespace can be unloaded cleanly ... OK
- checking loading without being on the library search path ... OK
- checking use of S3 registration ... OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [19s/22s] OK
- checking Rd files ... OK
- checking Rd metadata ... OK
- checking Rd line widths ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of 'data' directory ... OK
- checking data for non-ASCII characters ... OK
- checking data for ASCII and uncompressed saves ... OK
- checking installed files from 'inst/doc' ... OK
- checking files in 'vignettes' ... OK
- checking examples ... ERROR
Running examples in 'jmv-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: logRegOrd
> ### Title: Ordinal Logistic Regression
> ### Aliases: logRegOrd
>
> ### ** Examples
>
> set.seed(1337)
>
> y <- factor(sample(1:3, 100, replace = TRUE))
> x1 <- rnorm(100)
> x2 <- rnorm(100)
>
> df <- data.frame(y=y, x1=x1, x2=x2)
>
> logRegOrd(data = df, dep = y,
+ covs = vars(x1, x2),
+ blocks = list(list("x1", "x2")))
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
jmv
--- call from context ---
NULL
--- call from argument ---
if (class(CI[[i]]) == "try-error") CI[[i]] <- confint.default(models[[i]],
level = self$options$ciWidth/100)
--- R stacktrace ---
where 1: withCallingHandlers(expr, message = function(c) invokeRestart("muffleMessage"))
where 2: suppressMessages({
models <- list()
modelTest <- list()
lrTestTerms <- list()
dev <- list()
AIC <- list()
BIC <- list()
pseudoR <- list()
CI <- list()
CIOR <- list()
nullFormula <- as.formula(paste0(jmvcore::toB64(self$options$dep),
"~ 1"))
nullModel <- MASS::polr(nullFormula, data = data, model = TRUE,
Hess = TRUE)
null <- list(dev = nullModel$deviance, df = nullModel$edf)
for (i in seq_along(formulas)) {
models[[i]] <- MASS::polr(formulas[[i]], data = data,
model = TRUE, Hess = TRUE)
models[[i]]$call$formula <- formulas[[i]]
lrTestTerms[[i]] <- car::Anova(models[[i]], test = "LR",
type = 3, singular.ok = TRUE)
modelTest[[i]] <- private$.modelTest(models[[i]], null)
dev[[i]] <- models[[i]]$deviance
AIC[[i]] <- stats::AIC(models[[i]])
BIC[[i]] <- stats::BIC(models[[i]])
pseudoR[[i]] <- private$.pseudoR2(models[[i]], null)
CI[[i]] <- try(confint(models[[i]], level = self$options$ciWidth/100),
silent = TRUE)
if (class(CI[[i]]) == "try-error")
CI[[i]] <- confint.default(models[[i]], level = self$options$ciWidth/100)
CILO <- try(confint(models[[i]], level = self$options$ciWidthOR/100),
silent = TRUE)
if (class(CILO[[i]]) == "try-error")
CILO <- confint.default(models[[i]], level = self$options$ciWidthOR/100)
CIOR[[i]] <- exp(CILO)
}
if (length(formulas) > 1)
lrTest <- do.call(stats::anova, c(models, test = "Chisq"))
else lrTest <- NULL
})
where 3: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
where 4: suppressWarnings({
suppressMessages({
models <- list()
modelTest <- list()
lrTestTerms <- list()
dev <- list()
AIC <- list()
BIC <- list()
pseudoR <- list()
CI <- list()
CIOR <- list()
nullFormula <- as.formula(paste0(jmvcore::toB64(self$options$dep),
"~ 1"))
nullModel <- MASS::polr(nullFormula, data = data, model = TRUE,
Hess = TRUE)
null <- list(dev = nullModel$deviance, df = nullModel$edf)
for (i in seq_along(formulas)) {
models[[i]] <- MASS::polr(formulas[[i]], data = data,
model = TRUE, Hess = TRUE)
models[[i]]$call$formula <- formulas[[i]]
lrTestTerms[[i]] <- car::Anova(models[[i]], test = "LR",
type = 3, singular.ok = TRUE)
modelTest[[i]] <- private$.modelTest(models[[i]],
null)
dev[[i]] <- models[[i]]$deviance
AIC[[i]] <- stats::AIC(models[[i]])
BIC[[i]] <- stats::BIC(models[[i]])
pseudoR[[i]] <- private$.pseudoR2(models[[i]], null)
CI[[i]] <- try(confint(models[[i]], level = self$options$ciWidth/100),
silent = TRUE)
if (class(CI[[i]]) == "try-error")
CI[[i]] <- confint.default(models[[i]], level = self$options$ciWidth/100)
CILO <- try(confint(models[[i]], level = self$options$ciWidthOR/100),
silent = TRUE)
if (class(CILO[[i]]) == "try-error")
CILO <- confint.default(models[[i]], level = self$options$ciWidthOR/100)
CIOR[[i]] <- exp(CILO)
}
if (length(formulas) > 1)
lrTest <- do.call(stats::anova, c(models, test = "Chisq"))
else lrTest <- NULL
})
})
where 5: private$.compute(data)
where 6: private$.run()
where 7: eval(expr)
where 8: try({
result <- private$.run()
for (addon in private$.addons) {
private$.checkpoint()
addon$.__enclos_env__$private$.run()
}
}, silent = TRUE)
where 9: analysis$run()
where 10: logRegOrd(data = df, dep = y, covs = vars(x1, x2), blocks = list(list("x1",
"x2")))
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
--- function search by body ---
----------- END OF FAILURE REPORT --------------
Error in if (class(CI[[i]]) == "try-error") CI[[i]] <- confint.default(models[[i]], :
the condition has length > 1
Calls: logRegOrd ... <Anonymous> -> try -> eval -> <Anonymous> -> <Anonymous>
Execution halted
- checking for unstated dependencies in 'tests' ... OK
- checking tests ... [23s/24s] ERROR
Running 'testthat.R' [22s/23s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(jmv)
>
> test_check("jmv")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
jmv
--- call from context ---
NULL
--- call from argument ---
if (class(CI[[i]]) == "try-error") CI[[i]] <- confint.default(models[[i]],
level = self$options$ciWidth/100)
--- R stacktrace ---
where 1: withCallingHandlers(expr, message = function(c) invokeRestart("muffleMessage"))
where 2: suppressMessages({
models <- list()
modelTest <- list()
lrTestTerms <- list()
dev <- list()
AIC <- list()
BIC <- list()
pseudoR <- list()
CI <- list()
CIOR <- list()
nullFormula <- as.formula(paste0(jmvcore::toB64(self$options$dep),
"~ 1"))
nullModel <- MASS::polr(nullFormula, data = data, model = TRUE,
Hess = TRUE)
null <- list(dev = nullModel$deviance, df = nullModel$edf)
for (i in seq_along(formulas)) {
models[[i]] <- MASS::polr(formulas[[i]], data = data,
model = TRUE, Hess = TRUE)
models[[i]]$call$formula <- formulas[[i]]
lrTestTerms[[i]] <- car::Anova(models[[i]], test = "LR",
type = 3, singular.ok = TRUE)
modelTest[[i]] <- private$.modelTest(models[[i]], null)
dev[[i]] <- models[[i]]$deviance
AIC[[i]] <- stats::AIC(models[[i]])
BIC[[i]] <- stats::BIC(models[[i]])
pseudoR[[i]] <- private$.pseudoR2(models[[i]], null)
CI[[i]] <- try(confint(models[[i]], level = self$options$ciWidth/100),
silent = TRUE)
if (class(CI[[i]]) == "try-error")
CI[[i]] <- confint.default(models[[i]], level = self$options$ciWidth/100)
CILO <- try(confint(models[[i]], level = self$options$ciWidthOR/100),
silent = TRUE)
if (class(CILO[[i]]) == "try-error")
CILO <- confint.default(models[[i]], level = self$options$ciWidthOR/100)
CIOR[[i]] <- exp(CILO)
}
if (length(formulas) > 1)
lrTest <- do.call(stats::anova, c(models, test = "Chisq"))
else lrTest <- NULL
})
where 3: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
where 4: suppressWarnings({
suppressMessages({
models <- list()
modelTest <- list()
lrTestTerms <- list()
dev <- list()
AIC <- list()
BIC <- list()
pseudoR <- list()
CI <- list()
CIOR <- list()
nullFormula <- as.formula(paste0(jmvcore::toB64(self$options$dep),
"~ 1"))
nullModel <- MASS::polr(nullFormula, data = data, model = TRUE,
Hess = TRUE)
null <- list(dev = nullModel$deviance, df = nullModel$edf)
for (i in seq_along(formulas)) {
models[[i]] <- MASS::polr(formulas[[i]], data = data,
model = TRUE, Hess = TRUE)
models[[i]]$call$formula <- formulas[[i]]
lrTestTerms[[i]] <- car::Anova(models[[i]], test = "LR",
type = 3, singular.ok = TRUE)
modelTest[[i]] <- private$.modelTest(models[[i]],
null)
dev[[i]] <- models[[i]]$deviance
AIC[[i]] <- stats::AIC(models[[i]])
BIC[[i]] <- stats::BIC(models[[i]])
pseudoR[[i]] <- private$.pseudoR2(models[[i]], null)
CI[[i]] <- try(confint(models[[i]], level = self$options$ciWidth/100),
silent = TRUE)
if (class(CI[[i]]) == "try-error")
CI[[i]] <- confint.default(models[[i]], level = self$options$ciWidth/100)
CILO <- try(confint(models[[i]], level = self$options$ciWidthOR/100),
silent = TRUE)
if (class(CILO[[i]]) == "try-error")
CILO <- confint.default(models[[i]], level = self$options$ciWidthOR/100)
CIOR[[i]] <- exp(CILO)
}
if (length(formulas) > 1)
lrTest <- do.call(stats::anova, c(models, test = "Chisq"))
else lrTest <- NULL
})
})
where 5: private$.compute(data)
where 6: private$.run()
where 7: eval(expr)
where 8: try({
result <- private$.run()
for (addon in private$.addons) {
private$.checkpoint()
addon$.__enclos_env__$private$.run()
}
}, silent = TRUE)
where 9: analysis$run()
where 10 at testthat/testlogregord.R#13: jmv::logRegOrd(data = df, dep = "y", covs = c("x1", "x2"), blocks = list(list("x1",
"x2")))
where 11: eval(code, test_env)
where 12: eval(code, test_env)
where 13: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 14: doTryCatch(return(expr), name, parentenv, handler)
where 15: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 16: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 17: doTryCatch(return(expr), name, parentenv, handler)
where 18: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 19: tryCatchList(expr, classes, parentenv, handlers)
where 20: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 21: test_code(desc, code, env = parent.frame())
where 22 at testthat/testlogregord.R#3: test_that("logregord works", {
set.seed(1337)
y <- factor(sample(1:3, 100, replace = TRUE))
x1 <- rnorm(100)
x2 <- rnorm(100)
df <- data.frame(y = y, x1 = x1, x2 = x2)
logReg <- jmv::logRegOrd(data = df, dep = "y", covs = c("x1",
"x2"), blocks = list(list("x1", "x2")))
modelFit <- logReg$modelFit$asDF
coef <- logReg$models[[1]]$coef$asDF
expect_equal(0.000568, modelFit$r2mf[1], tolerance = 1e-06)
expect_equal(217.779, modelFit$dev[1], tolerance = 0.001)
expect_equal(0.058, coef$est[1], tolerance = 0.001)
expect_equal(0.172, coef$se[2], tolerance = 0.001)
expect_equal(0.848, coef$p[2], tolerance = 0.001)
})
where 23: eval(code, test_env)
where 24: eval(code, test_env)
where 25: withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error)
where 26: doTryCatch(return(expr), name, parentenv, handler)
where 27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 28: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 29: doTryCatch(return(expr), name, parentenv, handler)
where 30: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 31: tryCatchList(expr, classes, parentenv, handlers)
where 32: tryCatch(withCallingHandlers({
eval(code, test_env)
if (!handled && !is.null(test)) {
skip_empty()
}
}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
message = handle_message, error = handle_error), error = handle_fatal,
skip = function(e) {
})
where 33: test_code(NULL, exprs, env)
where 34: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 35: force(code)
where 36: doWithOneRestart(return(expr), restart)
where 37: withOneRestart(expr, restarts[[1L]])
where 38: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 39: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter,
{
reporter$start_file(basename(path))
lister$start_file(basename(path))
source_file(path, new.env(parent = env), chdir = TRUE,
wrap = wrap)
reporter$.end_context()
reporter$end_file()
})
where 40: FUN(X[[i]], ...)
where 41: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 42: force(code)
where 43: doWithOneRestart(return(expr), restart)
where 44: withOneRestart(expr, restarts[[1L]])
where 45: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 46: with_reporter(reporter = current_reporter, results <- lapply(paths,
test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE,
load_helpers = FALSE, wrap = wrap))
where 47: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 48: test_dir(path = test_path, reporter = reporter, env = env, filter = filter,
..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
wrap = wrap)
where 49: test_package_dir(package = package, test_path = test_path, filter = filter,
reporter = reporter, ..., stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 50: test_check("jmv")
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
--- function search by body ---
----------- END OF FAILURE REPORT --------------
-- 1. Error: logregord works (@testlogregord.R#13) ----------------------------
the condition has length > 1
Backtrace:
1. jmv::logRegOrd(...)
2. analysis$run()
5. private$.run()
6. private$.compute(data)
9. base::suppressMessages(...)
10. base::withCallingHandlers(expr, message = function(c) invokeRestart("muffleMessage"))
== testthat results ===========================================================
[ OK: 145 | SKIPPED: 0 | WARNINGS: 14 | FAILED: 1 ]
1. Error: logregord works (@testlogregord.R#13)
Error: testthat unit tests failed
Execution halted
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes in 'inst/doc' ... OK
- checking re-building of vignette outputs ... [1s/2s] OK
- checking PDF version of manual ... OK
- checking for non-standard things in the check directory ... OK
- DONE
Status: 2 ERRORs