Skip to content

Commit

Permalink
useNames = FALSE is the new default [#226]
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Nov 18, 2022
1 parent 7539ec8 commit 1992ae7
Show file tree
Hide file tree
Showing 51 changed files with 152 additions and 147 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: matrixStats
Version: 0.63.0-9000
Version: 0.63.0-9001
Depends:
R (>= 2.12.0)
Suggests:
Expand Down
7 changes: 5 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Version (development version)

* ...

## Significant Changes

* `useNames = FALSE` is the new default for all functions. For
backward compatibility, it used to be `useNames = NA` .


# Version 0.63.0 [2022-11-14]

Expand Down
8 changes: 4 additions & 4 deletions R/anyMissing.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ anyMissing <- function(x, idxs = NULL, ...) {

#' @rdname anyMissing
#' @export
colAnyMissings <- function(x, rows = NULL, cols = NULL, ..., useNames = NA) {
colAnyMissings <- function(x, rows = NULL, cols = NULL, ..., useNames = FALSE) {
colAnys(x, rows, cols, value = NA, ..., useNames = useNames)
}

#' @rdname anyMissing
#' @export
rowAnyMissings <- function(x, rows = NULL, cols = NULL, ..., useNames = NA) {
rowAnyMissings <- function(x, rows = NULL, cols = NULL, ..., useNames = FALSE) {
rowAnys(x, rows, cols, value = NA, ..., useNames = useNames)
}

#' @rdname anyMissing
#' @export
colAnyNAs <- function(x, rows = NULL, cols = NULL, ..., useNames = NA) {
colAnyNAs <- function(x, rows = NULL, cols = NULL, ..., useNames = FALSE) {
colAnys(x, rows, cols, value = NA, ..., useNames = useNames)
}

#' @rdname anyMissing
#' @export
rowAnyNAs <- function(x, rows = NULL, cols = NULL, ..., useNames = NA) {
rowAnyNAs <- function(x, rows = NULL, cols = NULL, ..., useNames = FALSE) {
rowAnys(x, rows, cols, value = NA, ..., useNames = useNames)
}
8 changes: 4 additions & 4 deletions R/rowAlls.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#' @keywords array logic iteration univar
#' @export
rowAlls <- function(x, rows = NULL, cols = NULL, value = TRUE,
na.rm = FALSE, dim. = dim(x), ..., useNames = NA) {
na.rm = FALSE, dim. = dim(x), ..., useNames = FALSE) {
if (is.numeric(x) && is.logical(value) && !is.na(value)) {
has_nas <- TRUE
if (isTRUE(value)) {
Expand Down Expand Up @@ -115,7 +115,7 @@ rowAlls <- function(x, rows = NULL, cols = NULL, value = TRUE,
#' @rdname rowAlls
#' @export
colAlls <- function(x, rows = NULL, cols = NULL, value = TRUE,
na.rm = FALSE, dim. = dim(x), ..., useNames = NA) {
na.rm = FALSE, dim. = dim(x), ..., useNames = FALSE) {
if (is.numeric(x) && is.logical(value) && !is.na(value)) {
has_nas <- TRUE
if (isTRUE(value)) {
Expand Down Expand Up @@ -203,7 +203,7 @@ allValue <- function(x, idxs = NULL, value = TRUE, na.rm = FALSE, ...) {
#' @rdname rowAlls
#' @export
rowAnys <- function(x, rows = NULL, cols = NULL, value = TRUE,
na.rm = FALSE, dim. = dim(x), ..., useNames = NA) {
na.rm = FALSE, dim. = dim(x), ..., useNames = FALSE) {
if (is.numeric(x) && is.logical(value) && !is.na(value)) {
has_nas <- TRUE
if (isTRUE(value)) {
Expand Down Expand Up @@ -249,7 +249,7 @@ rowAnys <- function(x, rows = NULL, cols = NULL, value = TRUE,
#' @rdname rowAlls
#' @export
colAnys <- function(x, rows = NULL, cols = NULL, value = TRUE,
na.rm = FALSE, dim. = dim(x), ..., useNames = NA) {
na.rm = FALSE, dim. = dim(x), ..., useNames = FALSE) {
if (is.numeric(x) && is.logical(value) && !is.na(value)) {
has_nas <- TRUE
if (isTRUE(value)) {
Expand Down
4 changes: 2 additions & 2 deletions R/rowCollapse.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#' cf. \code{\link[base]{[}}().
#' @keywords utilities
#' @export
rowCollapse <- function(x, idxs, rows = NULL, dim. = dim(x), ..., useNames = NA) {
rowCollapse <- function(x, idxs, rows = NULL, dim. = dim(x), ..., useNames = FALSE) {
# Argument 'x':
if (!is.matrix(x) && !is.vector(x)) defunctShouldBeMatrixOrVector(x)

Expand Down Expand Up @@ -61,7 +61,7 @@ rowCollapse <- function(x, idxs, rows = NULL, dim. = dim(x), ..., useNames = NA)

#' @rdname rowCollapse
#' @export
colCollapse <- function(x, idxs, cols = NULL, dim. = dim(x), ..., useNames = NA) {
colCollapse <- function(x, idxs, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
# Argument 'x':
if (!is.matrix(x) && !is.vector(x)) defunctShouldBeMatrixOrVector(x)

Expand Down
4 changes: 2 additions & 2 deletions R/rowCounts.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' @keywords array logic iteration univar
#' @export
rowCounts <- function(x, rows = NULL, cols = NULL, value = TRUE,
na.rm = FALSE, dim. = dim(x), ..., useNames = NA) {
na.rm = FALSE, dim. = dim(x), ..., useNames = FALSE) {
# Argument 'x':
if (is.matrix(x)) {
} else if (is.vector(x)) {
Expand Down Expand Up @@ -101,7 +101,7 @@ rowCounts <- function(x, rows = NULL, cols = NULL, value = TRUE,
#' @rdname rowCounts
#' @export
colCounts <- function(x, rows = NULL, cols = NULL, value = TRUE,
na.rm = FALSE, dim. = dim(x), ..., useNames = NA) {
na.rm = FALSE, dim. = dim(x), ..., useNames = FALSE) {
# Argument 'x':
if (is.matrix(x)) {
} else if (is.vector(x)) {
Expand Down
16 changes: 8 additions & 8 deletions R/rowCumsums.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,55 @@
#'
#' @keywords array iteration univar
#' @export
rowCumsums <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
rowCumsums <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCumsums, x, dim., rows, cols, TRUE, useNames)
}


#' @rdname rowCumsums
#' @export
colCumsums <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
colCumsums <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCumsums, x, dim., rows, cols, FALSE, useNames)
}


#' @rdname rowCumsums
#' @export
rowCumprods <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
rowCumprods <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCumprods, x, dim., rows, cols, TRUE, useNames)
}


#' @rdname rowCumsums
#' @export
colCumprods <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
colCumprods <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCumprods, x, dim., rows, cols, FALSE, useNames)
}


#' @rdname rowCumsums
#' @export
rowCummins <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
rowCummins <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCummins, x, dim., rows, cols, TRUE, useNames)
}


#' @rdname rowCumsums
#' @export
colCummins <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
colCummins <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCummins, x, dim., rows, cols, FALSE, useNames)
}


#' @rdname rowCumsums
#' @export
rowCummaxs <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
rowCummaxs <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCummaxs, x, dim., rows, cols, TRUE, useNames)
}


#' @rdname rowCumsums
#' @export
colCummaxs <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = NA) {
colCummaxs <- function(x, rows = NULL, cols = NULL, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowCummaxs, x, dim., rows, cols, FALSE, useNames)
}
4 changes: 2 additions & 2 deletions R/rowDiffs.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#' @keywords array iteration robust univar
#' @export
rowDiffs <- function(x, rows = NULL, cols = NULL,
lag = 1L, differences = 1L, dim. = dim(x), ..., useNames = NA) {
lag = 1L, differences = 1L, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowDiffs, x, dim., rows, cols, lag, differences, TRUE, useNames)
}

#' @rdname rowDiffs
#' @export
colDiffs <- function(x, rows = NULL, cols = NULL,
lag = 1L, differences = 1L, dim. = dim(x), ..., useNames = NA) {
lag = 1L, differences = 1L, dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowDiffs, x, dim., rows, cols, lag, differences, FALSE, useNames)
}
4 changes: 2 additions & 2 deletions R/rowIQRs.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#'
#' @importFrom stats quantile
#' @export
rowIQRs <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) {
rowIQRs <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = FALSE) {
Q <- rowQuantiles(x, rows = rows, cols = cols,
probs = c(0.25, 0.75), na.rm = na.rm, useNames = useNames, drop = FALSE, ...)
colnames(Q) <- NULL # Not needed anymore
Expand All @@ -41,7 +41,7 @@ rowIQRs <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames =

#' @rdname rowIQRs
#' @export
colIQRs <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) {
colIQRs <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = FALSE) {
Q <- colQuantiles(x, rows = rows, cols = cols,
probs = c(0.25, 0.75), na.rm = na.rm, useNames = useNames, drop = FALSE, ...)
colnames(Q) <- NULL # Not needed anymore
Expand Down
4 changes: 2 additions & 2 deletions R/rowLogSumExps.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' @keywords array
#' @export
rowLogSumExps <- function(lx, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(lx), ..., useNames = NA) {
dim. = dim(lx), ..., useNames = FALSE) {
has_na <- TRUE
.Call(C_rowLogSumExps, lx, dim., rows, cols, na.rm, has_na, TRUE, useNames)
}
Expand All @@ -47,7 +47,7 @@ rowLogSumExps <- function(lx, rows = NULL, cols = NULL, na.rm = FALSE,
#' @rdname rowLogSumExps
#' @export
colLogSumExps <- function(lx, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(lx), ..., useNames = NA) {
dim. = dim(lx), ..., useNames = FALSE) {
has_na <- TRUE
.Call(C_rowLogSumExps, lx, dim., rows, cols, na.rm, has_na, FALSE, useNames)
}
4 changes: 2 additions & 2 deletions R/rowMads.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @export
rowMads <- function(x, rows = NULL, cols = NULL, center = NULL,
constant = 1.4826, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
if (is.null(center)) {
constant <- as.numeric(constant)
has_nas <- TRUE
Expand Down Expand Up @@ -62,7 +62,7 @@ rowMads <- function(x, rows = NULL, cols = NULL, center = NULL,
#' @export
colMads <- function(x, rows = NULL, cols = NULL, center = NULL,
constant = 1.4826, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
if (is.null(center)) {
constant <- as.numeric(constant)
has_nas <- TRUE
Expand Down
4 changes: 2 additions & 2 deletions R/rowMeans2.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
#' @keywords array iteration robust univar
#' @export
rowMeans2 <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
has_nas <- TRUE
.Call(C_rowMeans2, x, dim., rows, cols, na.rm, has_nas, TRUE, useNames)
}

#' @rdname rowMeans2
#' @export
colMeans2 <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
has_nas <- TRUE
.Call(C_rowMeans2, x, dim., rows, cols, na.rm, has_nas, FALSE, useNames)
}
4 changes: 2 additions & 2 deletions R/rowMedians.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#' @keywords array iteration robust univar
#' @export
rowMedians <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
has_nas <- TRUE # Add as an argument? /2007-08-24

.Call(C_rowMedians, x, dim., rows, cols, na.rm, has_nas, TRUE, useNames)
Expand All @@ -49,7 +49,7 @@ rowMedians <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
#' @rdname rowMedians
#' @export
colMedians <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
has_nas <- TRUE # Add as an argument? /2007-08-24

.Call(C_rowMedians, x, dim., rows, cols, na.rm, has_nas, FALSE, useNames)
Expand Down
4 changes: 2 additions & 2 deletions R/rowOrderStats.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' @keywords array iteration robust univar
#' @export
rowOrderStats <- function(x, rows = NULL, cols = NULL, which,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {

# Check missing values
if (anyMissing(x)) {
Expand All @@ -43,7 +43,7 @@ rowOrderStats <- function(x, rows = NULL, cols = NULL, which,
#' @rdname rowOrderStats
#' @export
colOrderStats <- function(x, rows = NULL, cols = NULL, which,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {

# Check missing values
if (anyMissing(x)) {
Expand Down
4 changes: 2 additions & 2 deletions R/rowProds.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' @keywords array iteration robust univar
#' @export
rowProds <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
method = c("direct", "expSumLog"), ..., useNames = NA) {
method = c("direct", "expSumLog"), ..., useNames = FALSE) {
# Argument 'x':
if (!is.matrix(x)) defunctShouldBeMatrix(x)

Expand Down Expand Up @@ -79,7 +79,7 @@ rowProds <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
#' @rdname rowProds
#' @export
colProds <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
method = c("direct", "expSumLog"), ..., useNames = NA) {
method = c("direct", "expSumLog"), ..., useNames = FALSE) {
# Argument 'x':
if (!is.matrix(x)) defunctShouldBeMatrix(x)

Expand Down
4 changes: 2 additions & 2 deletions R/rowQuantiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#' @export
rowQuantiles <- function(x, rows = NULL, cols = NULL,
probs = seq(from = 0, to = 1, by = 0.25),
na.rm = FALSE, type = 7L, ..., useNames = NA, drop = TRUE) {
na.rm = FALSE, type = 7L, ..., useNames = FALSE, drop = TRUE) {
# Argument 'x':
if (!is.matrix(x)) defunctShouldBeMatrix(x)
if (!is.numeric(x) && !is.integer(x) && !is.logical(x)) {
Expand Down Expand Up @@ -156,7 +156,7 @@ rowQuantiles <- function(x, rows = NULL, cols = NULL,
#' @export
colQuantiles <- function(x, rows = NULL, cols = NULL,
probs = seq(from = 0, to = 1, by = 0.25),
na.rm = FALSE, type = 7L, ..., useNames = NA, drop = TRUE) {
na.rm = FALSE, type = 7L, ..., useNames = FALSE, drop = TRUE) {
# Argument 'x':
if (!is.matrix(x)) defunctShouldBeMatrix(x)
if (!is.numeric(x) && !is.integer(x) && !is.logical(x)) {
Expand Down
12 changes: 6 additions & 6 deletions R/rowRanges.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,46 @@
#'
#' @export
rowRanges <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowRanges, x, dim., rows, cols, 2L, na.rm, TRUE, useNames)
}


#' @rdname rowRanges
#' @export
rowMins <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowRanges, x, dim., rows, cols, 0L, na.rm, TRUE, useNames)
}


#' @rdname rowRanges
#' @export
rowMaxs <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
.Call(C_rowRanges, x, dim., rows, cols, 1L, na.rm, TRUE, useNames)
}


#' @rdname rowRanges
#' @export
colRanges <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
.Call(C_colRanges, x, dim., rows, cols, 2L, na.rm, TRUE, useNames)
}


#' @rdname rowRanges
#' @export
colMins <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
.Call(C_colRanges, x, dim., rows, cols, 0L, na.rm, TRUE, useNames)
}


#' @rdname rowRanges
#' @export
colMaxs <- function(x, rows = NULL, cols = NULL, na.rm = FALSE,
dim. = dim(x), ..., useNames = NA) {
dim. = dim(x), ..., useNames = FALSE) {
.Call(C_colRanges, x, dim., rows, cols, 1L, na.rm, TRUE, useNames)
}
Loading

0 comments on commit 1992ae7

Please sign in to comment.