Closed HenrikBengtsson closed 9 months ago
I can reproduce this with a recent R-devel version. To get going, here's how to reproduce it without involving R CMD check
:
> source("tests/rowCumMinMaxs.R", chdir=TRUE)
add_na = FALSE
mode: logical
logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ...
Error: r1 and r0 are not equal:
Attributes: < Length mismatch: comparison on first 1 components >
In addition: Warning messages:
1: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
2: useNames = NA is deprecated. Instead, specify either useNames = TRUE or useNames = FALSE.
This is because:
> str(r0)
int [1:10, 1:5] 0 1 1 1 1 1 1 1 1 1 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:10] "a" "b" "c" "d" ...
..$ : chr [1:5] "A" "B" "C" "D" ...
> str(r1)
int [1:10, 1:5] 0 1 1 1 1 1 1 1 1 1 ...
This is because in R-devel dim<-()
now preserved dimnames, whereas in R (< 4.4.0) it doesn't. For example,
in R 4.3.1:
> x <- array(1:6, dim = c(2, 3), dimnames = list(c("A", "B"), c("a", "b", "c")))
> str(dimnames(x))
List of 2
$ : chr [1:2] "A" "B"
$ : chr [1:3] "a" "b" "c"
> dim(x) <- dim(x)
> str(dimnames(x))
NULL
whereas in R-devel:
> x <- array(1:6, dim = c(2, 3), dimnames = list(c("A", "B"), c("a", "b", "c")))
> str(x)
int [1:2, 1:3] 1 2 3 4 5 6
- attr(*, "dimnames")=List of 2
..$ : chr [1:2] "A" "B"
..$ : chr [1:3] "a" "b" "c"
> dim(x) <- dim(x)
> str(x)
int [1:2, 1:3] 1 2 3 4 5 6
- attr(*, "dimnames")=List of 2
..$ : chr [1:2] "A" "B"
..$ : chr [1:3] "a" "b" "c"
Thus, our assumption in our tests that dim(y) <- dim(x)
removed dimnames
is no longer correct. We do that in many places, e.g.
The quick fix would be to add dimnames(y) <- NULL
, e.g.
dim(y) <- dim(x)
dimnames(y) <- NULL
dimnames <- dimnames(x)
The modification in R-devel causing this has been reverted.
There are several errors on https://cran.r-project.org/web/checks/check_results_matrixStats.html. All of them appears to be of kind: