HenrikBengtsson / matrixStats

R package: Methods that Apply to Rows and Columns of Matrices (and to Vectors)
https://cran.r-project.org/package=matrixStats
203 stars 33 forks source link

QUESTION: Why different arguments for colVars and colSds? #127

Closed PeteHaitch closed 6 years ago

PeteHaitch commented 6 years ago
> args(matrixStats::colVars)
function (x, rows = NULL, cols = NULL, na.rm = FALSE, center = NULL, 
    dim. = dim(x), ...) 
NULL
> args(matrixStats::colSds)
function (x, rows = NULL, cols = NULL, ...) 
NULL

I understand that na.rm, center, and dim.. can be passed to colSds() via ..., but wondering why they don't appear as formal arguments? Same for rowVars()/rowSds().

Thanks

HenrikBengtsson commented 6 years ago

This must have been because I wanted to keep the redundancy down so any tweaks of arguments could be done in a single place and thereby simplify documentation and lower the risk for mistakes.

Since args are settled by now, maybe it doesn't hurt to make them explicit everywhere - it would make it easy for the user and print(), args() would be more informative. Do you know of other cases in the package?

PeteHaitch commented 6 years ago

I suspected that was the reason.

No, I didn't find any other cases. (colRanks() has preserveShape whereas rowRanks() does not, but my reading of the docs is that this is for good reason)

HenrikBengtsson commented 6 years ago

Fixed.