Last updated on 2020-02-19 14:48:27 CET.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 1.0 | 43.04 | 65.94 | 108.98 | ERROR | |
r-devel-linux-x86_64-debian-gcc | 1.0 | 30.73 | 51.01 | 81.74 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 1.0 | 137.63 | ERROR | |||
r-devel-linux-x86_64-fedora-gcc | 1.0 | 134.59 | ERROR | |||
r-devel-windows-ix86+x86_64 | 1.0 | 72.00 | 105.00 | 177.00 | OK | |
r-devel-windows-ix86+x86_64-gcc8 | 1.0 | 104.00 | 111.00 | 215.00 | OK | |
r-patched-linux-x86_64 | 1.0 | 36.04 | 57.04 | 93.08 | OK | |
r-patched-solaris-x86 | 1.0 | 161.70 | NOTE | |||
r-release-linux-x86_64 | 1.0 | 36.07 | 59.16 | 95.23 | OK | |
r-release-windows-ix86+x86_64 | 1.0 | 68.00 | 104.00 | 172.00 | OK | |
r-release-osx-x86_64 | 1.0 | NOTE | ||||
r-oldrel-windows-ix86+x86_64 | 1.0 | 74.00 | 94.00 | 168.00 | OK | |
r-oldrel-osx-x86_64 | 1.0 | NOTE |
Version: 1.0
Check: examples
Result: ERROR
Running examples in 'rbridge-Ex.R' failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: bridge
> ### Title: Fit a Bridge Estimation
> ### Aliases: bridge
>
> ### ** Examples
>
> set.seed(2019)
> beta <- c(3, 1.5, 0, 0, 2, 0, 0, 0)
> p <- length(beta)
> beta <- matrix(beta, nrow = p, ncol = 1)
>
> n = 100
> X = matrix(rnorm(n*p),n,p)
> y = X%*%beta + rnorm(n)
>
> model1 <- bridge(X, y, q = 1)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
bridge(X, y, q = 1)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1: bridge(X, y, q = 1)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, lambda.min = ifelse(n > p, 0.001, 0.05),
nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- Bridge(XX, yy, q, lambda, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "bridge")
output
}
<bytecode: 0x974e688>
<environment: namespace:rbridge>
--- function search by body ---
Function bridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(X) != "matrix") { : the condition has length > 1
Calls: bridge
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 1.0
Check: tests
Result: ERROR
Running 'testthat.R' [5s/5s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> library(testthat)
> library(rbridge)
>
> test_check("rbridge")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
rbridge(X, y, q = 1, R1.mat, r1.vec)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1 at testthat/test.R#24: rbridge(X, y, q = 1, R1.mat, r1.vec)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: 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 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: 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 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: 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 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: 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 28: 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 29: test_check("rbridge")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, R, r, lambda.min = ifelse(n > p, 0.001,
0.05), nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- RBridge(XX, yy, q, lambda, R, r, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "rbridge")
output
}
<bytecode: 0x8d25880>
<environment: namespace:rbridge>
--- function search by body ---
Function rbridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
-- 1. Error: (unknown) (@test.R#24) -------------------------------------------
the condition has length > 1
Backtrace:
1. rbridge::rbridge(X, y, q = 1, R1.mat, r1.vec)
== testthat results ===========================================================
[ OK: 0 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
1. Error: (unknown) (@test.R#24)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-clang
Version: 1.0
Check: examples
Result: ERROR
Running examples in ‘rbridge-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: bridge
> ### Title: Fit a Bridge Estimation
> ### Aliases: bridge
>
> ### ** Examples
>
> set.seed(2019)
> beta <- c(3, 1.5, 0, 0, 2, 0, 0, 0)
> p <- length(beta)
> beta <- matrix(beta, nrow = p, ncol = 1)
>
> n = 100
> X = matrix(rnorm(n*p),n,p)
> y = X%*%beta + rnorm(n)
>
> model1 <- bridge(X, y, q = 1)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
bridge(X, y, q = 1)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1: bridge(X, y, q = 1)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, lambda.min = ifelse(n > p, 0.001, 0.05),
nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- Bridge(XX, yy, q, lambda, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "bridge")
output
}
<bytecode: 0x562c42f9cc58>
<environment: namespace:rbridge>
--- function search by body ---
Function bridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(X) != "matrix") { : the condition has length > 1
Calls: bridge
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.0
Check: tests
Result: ERROR
Running ‘testthat.R’ [3s/5s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(rbridge)
>
> test_check("rbridge")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
rbridge(X, y, q = 1, R1.mat, r1.vec)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1 at testthat/test.R#24: rbridge(X, y, q = 1, R1.mat, r1.vec)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: 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 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: 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 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: 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 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: 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 28: 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 29: test_check("rbridge")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, R, r, lambda.min = ifelse(n > p, 0.001,
0.05), nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- RBridge(XX, yy, q, lambda, R, r, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "rbridge")
output
}
<bytecode: 0x55db791081e8>
<environment: namespace:rbridge>
--- function search by body ---
Function rbridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
── 1. Error: (unknown) (@test.R#24) ───────────────────────────────────────────
the condition has length > 1
Backtrace:
1. rbridge::rbridge(X, y, q = 1, R1.mat, r1.vec)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
1. Error: (unknown) (@test.R#24)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.0
Check: dependencies in R code
Result: NOTE
Namespace in Imports field not imported from: ‘dplyr’
All declared Imports should be used.
Flavors: r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-patched-solaris-x86, r-release-osx-x86_64, r-oldrel-osx-x86_64
Version: 1.0
Check: examples
Result: ERROR
Running examples in ‘rbridge-Ex.R’ failed
The error most likely occurred in:
> ### Name: bridge
> ### Title: Fit a Bridge Estimation
> ### Aliases: bridge
>
> ### ** Examples
>
> set.seed(2019)
> beta <- c(3, 1.5, 0, 0, 2, 0, 0, 0)
> p <- length(beta)
> beta <- matrix(beta, nrow = p, ncol = 1)
>
> n = 100
> X = matrix(rnorm(n*p),n,p)
> y = X%*%beta + rnorm(n)
>
> model1 <- bridge(X, y, q = 1)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
bridge(X, y, q = 1)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1: bridge(X, y, q = 1)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, lambda.min = ifelse(n > p, 0.001, 0.05),
nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- Bridge(XX, yy, q, lambda, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "bridge")
output
}
<bytecode: 0xa8264f8>
<environment: namespace:rbridge>
--- function search by body ---
Function bridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(X) != "matrix") { : the condition has length > 1
Calls: bridge
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 1.0
Check: tests
Result: ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(rbridge)
>
> test_check("rbridge")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
rbridge(X, y, q = 1, R1.mat, r1.vec)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1 at testthat/test.R#24: rbridge(X, y, q = 1, R1.mat, r1.vec)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: 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 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: 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 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: 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 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: 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 28: 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 29: test_check("rbridge")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, R, r, lambda.min = ifelse(n > p, 0.001,
0.05), nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- RBridge(XX, yy, q, lambda, R, r, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "rbridge")
output
}
<bytecode: 0x94ff848>
<environment: namespace:rbridge>
--- function search by body ---
Function rbridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
── 1. Error: (unknown) (@test.R#24) ───────────────────────────────────────────
the condition has length > 1
Backtrace:
1. rbridge::rbridge(X, y, q = 1, R1.mat, r1.vec)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
1. Error: (unknown) (@test.R#24)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang
Version: 1.0
Check: examples
Result: ERROR
Running examples in ‘rbridge-Ex.R’ failed
The error most likely occurred in:
> ### Name: bridge
> ### Title: Fit a Bridge Estimation
> ### Aliases: bridge
>
> ### ** Examples
>
> set.seed(2019)
> beta <- c(3, 1.5, 0, 0, 2, 0, 0, 0)
> p <- length(beta)
> beta <- matrix(beta, nrow = p, ncol = 1)
>
> n = 100
> X = matrix(rnorm(n*p),n,p)
> y = X%*%beta + rnorm(n)
>
> model1 <- bridge(X, y, q = 1)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
bridge(X, y, q = 1)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1: bridge(X, y, q = 1)
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, lambda.min = ifelse(n > p, 0.001, 0.05),
nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- Bridge(XX, yy, q, lambda, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "bridge")
output
}
<bytecode: 0xa53cfc0>
<environment: namespace:rbridge>
--- function search by body ---
Function bridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(X) != "matrix") { : the condition has length > 1
Calls: bridge
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc
Version: 1.0
Check: tests
Result: ERROR
Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(rbridge)
>
> test_check("rbridge")
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
rbridge
--- call from context ---
rbridge(X, y, q = 1, R1.mat, r1.vec)
--- call from argument ---
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
--- R stacktrace ---
where 1 at testthat/test.R#24: rbridge(X, y, q = 1, R1.mat, r1.vec)
where 2: eval(code, test_env)
where 3: eval(code, test_env)
where 4: 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 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
where 8: doTryCatch(return(expr), name, parentenv, handler)
where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
names[nh], parentenv, handlers[[nh]])
where 10: tryCatchList(expr, classes, parentenv, handlers)
where 11: 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 12: test_code(NULL, exprs, env)
where 13: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
where 14: force(code)
where 15: doWithOneRestart(return(expr), restart)
where 16: withOneRestart(expr, restarts[[1L]])
where 17: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 18: 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 19: FUN(X[[i]], ...)
where 20: lapply(paths, test_file, env = env, reporter = current_reporter,
start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
where 21: force(code)
where 22: doWithOneRestart(return(expr), restart)
where 23: withOneRestart(expr, restarts[[1L]])
where 24: withRestarts(testthat_abort_reporter = function() NULL, force(code))
where 25: 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 26: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure,
stop_on_warning = stop_on_warning, wrap = wrap)
where 27: 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 28: 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 29: test_check("rbridge")
--- value of length: 2 type: logical ---
[1] FALSE TRUE
--- function from context ---
function (X, y, q = 1, R, r, lambda.min = ifelse(n > p, 0.001,
0.05), nlambda = 100, lambda, eta = 1e-07, converge = 10^10)
{
if (class(X) != "matrix") {
tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("X must be a matrix or able to be coerced to a matrix")
}
if (storage.mode(X) == "integer")
storage.mode(X) <- "double"
if (class(y) != "numeric") {
tmp <- try(y <- as.numeric(y), silent = TRUE)
if (class(tmp)[1] == "try-error")
stop("y must numeric or able to be coerced to numeric")
}
if (nlambda < 2)
stop("nlambda must be at least 2")
if (q > 2)
stop("a must be less than 2; choose a small positive number instead")
if (any(is.na(y)) | any(is.na(X)))
stop("Missing data (NA's) detected. Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing X and y to ncvreg")
if (length(y) != nrow(X))
stop("X and y do not have the same number of observations")
stdX <- standard(X)
XX <- stdX$xx
p <- ncol(XX)
ns <- c(1:p)
yy <- y - mean(y)
n <- length(yy)
if (missing(lambda)) {
lambda <- Lambdas_Grid(XX, yy, q, lambda.min, nlambda)
user.lambda <- FALSE
}
else {
nlambda <- length(lambda)
user.lambda <- TRUE
}
fit <- RBridge(XX, yy, q, lambda, R, r, converge, eta)
constant <- rep(mean(y), nlambda)
betas <- matrix(fit, p, nlambda)
unbetas <- matrix(0, nrow = (ncol(X) + 1), ncol = length(lambda))
bbetas <- betas/as.vector(stdX$s)
unbetas[ns + 1, ] <- bbetas
unbetas[1, ] <- constant - crossprod(as.vector(stdX$c), bbetas)
varnames <- if (is.null(colnames(X)))
paste("V", 1:ncol(X), sep = "")
else colnames(X)
varnames <- c("(Intercept)", varnames)
dimnames(unbetas) <- list(varnames, lambda)
output <- structure(list(betas = unbetas, lambda = lambda),
class = "rbridge")
output
}
<bytecode: 0x925c130>
<environment: namespace:rbridge>
--- function search by body ---
Function rbridge in namespace rbridge has this body.
----------- END OF FAILURE REPORT --------------
── 1. Error: (unknown) (@test.R#24) ───────────────────────────────────────────
the condition has length > 1
Backtrace:
1. rbridge::rbridge(X, y, q = 1, R1.mat, r1.vec)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 0 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
1. Error: (unknown) (@test.R#24)
Error: testthat unit tests failed
Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc