const-ae / const-ae/sparseMatrixStats
`row/colVars()` and `row/colSds()` methods for xgCMatrix objects silently ignore the supplied `center`
- 主要言語
- R
- スター
- 55
- フォーク
- 3
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
See for example the definition of the `rowVars()` method:
```
library(sparseMatrixStats)
selectMethod("rowVars", "xgCMatrix")
# Method Definition:
#
# function (x, rows = NULL, cols = NULL, na.rm = FALSE, center = NULL, ...)
# {
# .local <- function (x, rows = NULL, cols = NULL, na.rm = FALSE)
# {
# if (!is.null(rows)) {
# x <- x[rows, , drop = FALSE]
# }
# if (!is.null(cols)) {
# x <- x[, cols, drop = FALSE]
# }
# dgCMatrix_rowVars(x, na_rm = na.rm)
# }
# .local(x, rows, cols, na.rm, ...)
# }
#
#
#
# Signatures:
# x
# target "xgCMatrix"
# defined "xgCMatrix"
```
Here is a concrete example using a dgCMatrix object:
```
library(Matrix)
i <- 1:5
j <- 2:6
m0 <- sparseMatrix(i, j, x=10*i+j, dims=c(5, 7)) # dgCMatrix object
```
`center` not supplied:
```
matrixStats::rowVars(as.matrix(m0))
# [1] 20.57143 75.57143 165.14286 289.28571 448.00000
rowVars(m0)
# [1] 20.57143 75.57143 165.14286 289.28571 448.00000
```
`center` supplied:
```
matrixStats::rowVars(as.matrix(m0), center=0)
# [1] 24.00000 88.16667 192.66667 337.50000 522.66667
rowVars(m0, center=0) # 'center' is ignored!
# [1] 20.57143 75.57143 165.14286 289.28571 448.00000
```
Thanks,
H.
**sessionInfo():**
```
R Under development (unstable) (2020-10-28 r79382)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.7 LTS
Matrix products: default
BLAS: /home/hpages/R/R-4.1.r79382/lib/libRblas.so
LAPACK: /home/hpages/R/R-4.1.r79382/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Matrix_1.2-18 sparseMatrixStats_1.3.0 MatrixGenerics_1.3.0
[4] matrixStats_0.57.0
loaded via a namespace (and not attached):
[1] compiler_4.1.0 Rcpp_1.0.5 grid_4.1.0 lattice_0.20-41
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず、xgCMatrix の rowVars()、colVars()、rowSds()、colSds() メソッドを調べ、提供された selectMethod("rowVars", "xgCMatrix") の出力と dgCMatrix の例を使って動作を再現します。center を指定すると matrixStats::rowVars() と同じように結果が変わることを確認します。4 つのメソッドすべてが指定された center を一貫して尊重すれば、issue は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100