S4Vectors icon indicating copy to clipboard operation
S4Vectors copied to clipboard

`subset()` fails with zero-dimension objects and missing values

Open mtmorgan opened this issue 4 years ago • 1 comments

Compare

> subset(DataFrame())
Error: subscript is a logical vector with out-of-bounds TRUE values
> subset(data.frame())
data frame with 0 columns and 0 rows

This is because https://github.com/Bioconductor/S4Vectors/blob/b14a989db670382566500d025e49e15fbf46ac12/R/eval-utils.R#L47 returns a length 1 logical vector regardless the dimensions of x.

This is the reason for https://github.com/Bioconductor/VariantAnnotation/issues/40, with j incorrect at https://github.com/Bioconductor/VariantAnnotation/blob/61ecbd8e019cd3e15013506fc5ec6a4495829f7c/R/methods-VCF-class.R#L336

mtmorgan avatar May 27 '20 09:05 mtmorgan