-
Notifications
You must be signed in to change notification settings - Fork 5
Check fails for r-devel #10
Copy link
Copy link
Closed
Description
Summary
lsasim 2.0.0 fails when checking as CRAN in R development version.
Steps to reproduce
- Download and install R-devel (https://stat.ethz.ch/R/daily/). Using build r77519 from 2019-12-04.
- Run
R CMD check --as-cranon the package tarball
Failure report
Running examples in ‘lsasim-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: cov_gen
> ### Title: Generation of covariance matrices
> ### Aliases: cov_gen
>
> ### ** Examples
>
> vcov <- cov_gen(pr_grp_1 = .5, n_fac = 3, n_ind = 2)
----------- FAILURE REPORT --------------
--- failure: the condition has length > 1 ---
--- srcref ---
:
--- package (from environment) ---
lsasim
--- call from context ---
cov_yxw_gen(n_ind, n_z, Phi, n_fac, Lambda)
--- call from argument ---
if (class(Lambda) %in% c("numeric", "integer")) {
Lambda <- lambda_gen(n_ind, n_fac, Lambda, x_names, f_names)
} else {
dimnames(Lambda) <- list(x_names, f_names)
}
--- R stacktrace ---
where 1: cov_yxw_gen(n_ind, n_z, Phi, n_fac, Lambda)
where 2: cov_gen(pr_grp_1 = 0.5, n_fac = 3, n_ind = 2)
--- value of length: 2 type: logical ---
[1] FALSE FALSE
--- function from context ---
function (n_ind, n_z, Phi, n_fac, Lambda)
{
n_ind_rep <- rep(n_ind, n_fac)
x_names <- paste0("x", 1:sum(n_ind_rep))
f_names <- paste0("f", 1:length(n_ind_rep))
w_names <- paste0("w", 1:n_z)
rownames(Phi) <- colnames(Phi) <- c("y", f_names, w_names)
l_start <- cumsum(n_ind_rep) - (n_ind_rep - 1)
l_end <- l_start + n_ind_rep - 1
n_yxw <- 1 + sum(n_ind_rep) + n_z
vcov_yxw <- matrix(NA, nrow = n_yxw, ncol = n_yxw)
rownames(vcov_yxw) <- colnames(vcov_yxw) <- c("y", x_names,
w_names)
if (class(Lambda) %in% c("numeric", "integer")) {
Lambda <- lambda_gen(n_ind, n_fac, Lambda, x_names, f_names)
}
else {
dimnames(Lambda) <- list(x_names, f_names)
}
Phi_f <- Phi[2:(n_fac + 1), 2:(n_fac + 1)]
cov_x <- Lambda %*% Phi_f %*% t(Lambda)
var_xf <- Lambda^2 %*% Phi_f + (1 - Lambda^2)
indicator_vars <- list()
for (i in seq(n_ind_rep)) {
indicator_vars[[i]] <- var_xf[l_start[i]:l_end[i], i]
}
diag(cov_x) <- unlist(indicator_vars)
x_indices <- 2:(length(diag(cov_x)) + 1)
vcov_yxw[x_indices, x_indices] <- cov_x
for (i in seq(n_ind_rep)) {
l_seq <- l_start[i]:l_end[i]
vcov_yxw[1, l_seq + 1] <- Lambda[l_seq, i] * Phi[1, (i +
1)]
vcov_yxw[l_seq + 1, 1] <- t(vcov_yxw[1, l_seq + 1])
}
wcol_yxw <- match(w_names, colnames(vcov_yxw))
wcol_Phi <- match(w_names, colnames(Phi))
for (i in seq(n_ind_rep)) {
l_seq <- l_start[i]:l_end[i]
vcov_yxw[wcol_yxw, l_seq + 1] <- Lambda[l_seq, i] * Phi[wcol_Phi,
(i + 1)]
vcov_yxw[l_seq + 1, wcol_yxw] <- t(vcov_yxw[wcol_yxw,
l_seq + 1])
}
vcov_yxw[1, wcol_yxw] <- vcov_yxw[wcol_yxw, 1] <- Phi[1,
wcol_Phi]
diag(vcov_yxw) <- 1
return(vcov_yxw)
}
<bytecode: 0x558548582358>
<environment: namespace:lsasim>
--- function search by body ---
Function cov_yxw_gen in namespace lsasim has this body.
----------- END OF FAILURE REPORT --------------
Error in if (class(Lambda) %in% c("numeric", "integer")) { :
the condition has length > 1
Calls: cov_gen -> cov_yxw_gen
Execution halted
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
Running ‘testthat.R’ [14s/14s]
ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
--- function search by body ---
Function cov_yxw_gen in namespace lsasim has this body.
----------- END OF FAILURE REPORT --------------
── 1. Error: Function ouput identical to script (@test.replicateScript.R#8) ───
the condition has length > 1
Backtrace:
1. lsasim::cov_gen(...)
2. lsasim:::cov_yxw_gen(n_ind, n_z, Phi, n_fac, Lambda)
══ testthat results ═══════════════════════════════════════════════════════════
[ OK: 122 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
1. Error: Function ouput identical to script (@test.replicateScript.R#8)
Error: testthat unit tests failed
Execution halted
Likely cause
r-devel now outputs class(matrix(1:4, 2, 2)) as [1] "matrix" "array" (and no longer just "matrix" as before). Consequently, conditions of length greater than one in 'if' and 'while' statements give an error.
Urgency
Resubmit to CRAN by 2018-12-18.
Reactions are currently unavailable