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 subsetting by single row/column does not retain names #78

Closed LTLA closed 3 years ago

LTLA commented 3 years ago

Pretty much as the title says:

mat <- matrix(runif(200), 10, dimnames=list(NULL, LETTERS[1:20]))
mat[1,]
##          A          B          C          D          E          F          G 
## 0.34402519 0.22245344 0.39550796 0.08959282 0.68697863 0.61027313 0.86744204 
##          H          I          J          K          L          M          N 
## 0.81839423 0.95793274 0.48618751 0.41612652 0.90650978 0.61053230 0.38456894 
##          O          P          Q          R          S          T 
## 0.45970455 0.64318125 0.53210578 0.48674306 0.17477731 0.31208342 

library(DelayedArray)
X <- DelayedArray(mat)
X[1,]
##  [1] 0.34402519 0.22245344 0.39550796 0.08959282 0.68697863 0.61027313
##  [7] 0.86744204 0.81839423 0.95793274 0.48618751 0.41612652 0.90650978
## [13] 0.61053230 0.38456894 0.45970455 0.64318125 0.53210578 0.48674306
## [19] 0.17477731 0.31208342

In contrast, everything behaves as expected with drop=FALSE.

hpages commented 3 years ago

Thanks. Fixed in DelayedArray 0.17.3 (see commit 8623979c85fff8be8721845981ba1673d6b8ff83).