Bioconductor / DelayedArray

A unified framework for working transparently with on-disk and in-memory array-like datasets
https://bioconductor.org/packages/DelayedArray
24 stars 9 forks source link

DelayedArray vector multiplication reports unnecessary column name #94

Closed LTLA closed 1 month ago

LTLA commented 3 years ago

For example:

library(DelayedArray)
x <- DelayedArray(matrix(rnorm(100), ncol=5))
y <- 1:5
x %*% y
## <20 x 1> matrix of class DelayedMatrix and type "double":
##                y
##  [1,] 10.3236828
##  [2,] -1.2810522
##  [3,]  2.4363280
##  [4,]  0.1778817
##  [5,] -6.2913926
##   ...          .
## [16,] -2.9174259
## [17,]  3.5204951
## [18,]  8.4410877
## [19,]  0.5144509
## [20,]  4.9493108

as.matrix(x) %*% y # for comparison
##              [,1]
##  [1,]  10.3236828
##  [2,]  -1.2810522
##  [3,]   2.4363280
##  [4,]   0.1778817
##  [5,]  -6.2913926
##  [6,] -16.0723576
##  [7,]  21.2219630
##  etc.

Looks like the fault of the various cbind(y) and rbind(y) calls, e.g., at

https://github.com/Bioconductor/DelayedArray/blob/f98fafea313f1a21f3447ce15f7b20f9ff07c639/R/DelayedMatrix-utils.R#L333

which capture the name of the input variable, for whatever reason. Probably should have set deparse.level=0.

hpages commented 1 month ago

Also gone in recent versions of DelayedArray (see issue #95).