[BioC] IRanges::Rle::[ arguably should return NA when i is out of range

Cook, Malcolm MEC at stowers.org
Mon Mar 10 19:52:22 CET 2014

I think the semantics of indexing into an Rles should be the same as indexing into the corresponding vector.

But it is not in the case when indices are out of bounds.


> c(1:10)[10:13]
[1] 10 NA NA NA

> Rle(c(1:10))[10:13]
Error in normalizeSingleBracketSubscript(i, x) : 
  subscript contains NAs or out of bounds indices

I've made similar arguments before which were taken up, as in https://stat.ethz.ch/pipermail/bioconductor/2013-September/054820.html

Is there a good reason NOT to change these semantics?

In the meantime, any suggested clever workarounds to get such extraction semantics?


~ Malcolm Cook 
Computational Biology / Shilatifard Lab - Stowers Institute for Medical Research - Kansas City

More information about the Bioconductor mailing list