[BioC] BUG: median(IRanges::Rle(NA), na.rm=TRUE)) should return NA

Cook, Malcolm MEC at stowers.org
Wed Sep 4 16:53:10 CEST 2013


A little further sleuthing suggests that perhaps the more general issues is that

> Rle()[FALSE]
Error in Rle()[FALSE] : subscript out of bounds
# but
> vector()[FALSE][NA]
[1] NA



 >-----Original Message-----
 >From: Cook, Malcolm
 >Sent: Wednesday, September 04, 2013 9:28 AM
 >To: 'bioconductor at r-project.org'; 'Hervé Pagès'; 'lawrence.michael at gene.com'
 >Cc: Chen, Guangbo; Johnston, Jeffrey
 >Subject: BUG: median(IRanges::Rle(NA),na.rm=TRUE)) should return NA
 >
 >Hi,
 >
 >I think the Rle functions should preserve semantics from stats.
 >
 >Here is at least one case where they do not:
 >
 >> median(Rle(NA),na.rm=TRUE)
 >Error in x[FALSE] : subscript out of bounds
 >
 ># but:
 >
 >> median(c(NA),na.rm=TRUE)
 >[1] NA
 >
 ># some other border cases:
 >
 >> median(c())
 >NULL
 ># arguably correct, if you read the docs and appreciate that as(NA,class(c())) is NULL
 >
 >> median(Rle())
 >Error in x[FALSE] : subscript out of bounds
 ># should probably be NULL
 >
 >
 >Agreed?
 >
 >Can be fixed?
 >
 >Thanks!
 >
 >~ Malcolm Cook
 >Computational Biology / Shilatifard Lab - Stowers Institute for Medical Research - Kansas City
 >



More information about the Bioconductor mailing list