Skip to content

Commit 04847eb

Browse files
committed
For r-devel replace (row|col)Means reference with apply
1 parent e3b3de6 commit 04847eb

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2025-08-26 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/tinytest/test_sugar.R: For r-devel, use apply(x, DIM, mean,
4+
na.rm=TRUE) instead of (row|col)Means for complex NA valued matrices
5+
16
2025-08-24 Dirk Eddelbuettel <[email protected]>
27

38
* .github/workflows/ci.yaml (jobs): Re-enable coverage, roll checkout

inst/tinytest/test_sugar.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,11 +1269,20 @@ expect_equal(cx_col_sums(x), colSums(x), info = "complex / colSums / keep NA / m
12691269
expect_equal(cx_col_sums(x, TRUE), colSums(x, TRUE), info = "complex / colSums / rm NA / mixed input")
12701270

12711271
expect_equal(cx_row_means(x), rowMeans(x), info = "complex / rowMeans / keep NA / mixed input")
1272-
if (getRversion() < "4.6.0") expect_equal(cx_row_means(x, TRUE), rowMeans(x, TRUE), info = "complex / rowMeans / rm NA / mixed input") ## TODO FIXME R-devel
1272+
if (getRversion() < "4.6.0") {
1273+
expect_equal(cx_row_means(x, TRUE), rowMeans(x, TRUE), info = "complex / rowMeans / rm NA / mixed input")
1274+
} else {
1275+
## TODO FIXME R-devel has borked rowMeans / colMeans for complex matrices with NA values
1276+
expect_equal(cx_row_means(x, TRUE), apply(x, 1, mean, na.rm=TRUE), info = "complex / rowMeans / rm NA / mixed input")
1277+
}
12731278

12741279
expect_equal(cx_col_means(x), colMeans(x), info = "complex / colMeans / keep NA / mixed input")
1275-
if (getRversion() < "4.6.0") expect_equal(cx_col_means(x, TRUE), colMeans(x, TRUE), info = "complex / colMeans / rm NA / mixed input") ## TODO FIXME R-devel
1276-
1280+
if (getRversion() < "4.6.0") {
1281+
expect_equal(cx_col_means(x, TRUE), colMeans(x, TRUE), info = "complex / colMeans / rm NA / mixed input")
1282+
} else {
1283+
## TODO FIXME R-devel has borked rowMeans / colMeans for complex matrices with NA values
1284+
expect_equal(cx_row_means(x, TRUE), apply(x, 2, mean, na.rm=TRUE), info = "complex / rowMeans / rm NA / mixed input")
1285+
}
12771286

12781287
x[] <- NA_complex_
12791288

0 commit comments

Comments
 (0)