From 378374b9119492e096df28d791442b1e0a4fa2bf Mon Sep 17 00:00:00 2001 From: const-ae Date: Mon, 28 Sep 2020 13:03:57 +0200 Subject: [PATCH] Add ellipsis to rowProds so that `method` argument doesn't fail Starts to address #7 --- R/methods.R | 2 +- R/methods_row.R | 2 +- man/colProds-xgCMatrix-method.Rd | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/R/methods.R b/R/methods.R index 9c1850d..296b7d8 100644 --- a/R/methods.R +++ b/R/methods.R @@ -138,7 +138,7 @@ setMethod("colLogSumExps", signature(lx = "xgCMatrix"), #' #' @export setMethod("colProds", signature(x = "xgCMatrix"), - function(x, rows = NULL, cols = NULL, na.rm=FALSE){ + function(x, rows = NULL, cols = NULL, na.rm=FALSE, ...){ if(! is.null(rows)){ x <- x[rows, , drop = FALSE] } diff --git a/R/methods_row.R b/R/methods_row.R index 251c5ff..4a02057 100644 --- a/R/methods_row.R +++ b/R/methods_row.R @@ -116,7 +116,7 @@ setMethod("rowLogSumExps", signature(lx = "xgCMatrix"), #' @rdname colProds-xgCMatrix-method #' @export setMethod("rowProds", signature(x = "xgCMatrix"), - function(x, rows = NULL, cols = NULL, na.rm=FALSE){ + function(x, rows = NULL, cols = NULL, na.rm=FALSE, ...){ if(! is.null(rows)){ x <- x[rows, , drop = FALSE] } diff --git a/man/colProds-xgCMatrix-method.Rd b/man/colProds-xgCMatrix-method.Rd index 96e55e9..b7f9493 100644 --- a/man/colProds-xgCMatrix-method.Rd +++ b/man/colProds-xgCMatrix-method.Rd @@ -5,9 +5,9 @@ \alias{rowProds,xgCMatrix-method} \title{Calculates the product for each row (column) in a matrix} \usage{ -\S4method{colProds}{xgCMatrix}(x, rows = NULL, cols = NULL, na.rm = FALSE) +\S4method{colProds}{xgCMatrix}(x, rows = NULL, cols = NULL, na.rm = FALSE, ...) -\S4method{rowProds}{xgCMatrix}(x, rows = NULL, cols = NULL, na.rm = FALSE) +\S4method{rowProds}{xgCMatrix}(x, rows = NULL, cols = NULL, na.rm = FALSE, ...) } \arguments{ \item{x}{An NxK matrix-like object.} @@ -22,6 +22,8 @@ done.} \item{na.rm}{If \code{\link[base:logical]{TRUE}}, \code{\link{NA}}s are excluded first, otherwise not.} + +\item{...}{Additional arguments passed to specific methods.} } \value{ Returns a \code{\link{numeric}} \code{\link{vector}} of length N (K).