[BioC] IRanges causes bug in complete.cases

Kasper Daniel Hansen khansen at stat.berkeley.edu
Thu Dec 10 21:17:35 CET 2009


After loading IRanges, complete.cases ceases to work (see below).  Test via example("complete.cases", package = "stats")

To avoid stuff like this in the future, perhaps it would make sense to think of some kind of testing for packages making an S4 generic out of a "base" function.

Kasper

compute-0-5:~/> R-devel

R version 2.11.0 Under development (unstable) (2009-12-08 r50689)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> example(complete.cases)

cmplt.> x <- airquality[, -1] # x is a regression design matrix

cmplt.> y <- airquality[,  1] # y is the corresponding response

cmplt.> stopifnot(complete.cases(y) != is.na(y))

cmplt.> ok <- complete.cases(x,y)

cmplt.> sum(!ok) # how many are not "ok" ?
[1] 42

cmplt.> x <- x[ok,]

cmplt.> y <- y[ok]
> library(IRanges)

Attaching package: 'IRanges'


	The following object(s) are masked from package:base :

	 cbind,
	 Map,
	 mapply,
	 order,
	 pmax,
	 pmax.int,
	 pmin,
	 pmin.int,
	 rbind,
	 rep.int,
	 table 

> example(complete.cases, package = "stats") 

cmplt.> x <- airquality[, -1] # x is a regression design matrix

cmplt.> y <- airquality[,  1] # y is the corresponding response

cmplt.> stopifnot(complete.cases(y) != is.na(y))
Error: '...' used in an incorrect context
Error in complete.cases(y) : 
  error in evaluating the argument '...' in selecting a method for function 'complete.cases'
> sessionInfo()
R version 2.11.0 Under development (unstable) (2009-12-08 r50689) 
x86_64-unknown-linux-gnu 

locale:
 [1] LC_CTYPE=en_US.iso885915       LC_NUMERIC=C                  
 [3] LC_TIME=en_US.iso885915        LC_COLLATE=en_US.iso885915    
 [5] LC_MONETARY=C                  LC_MESSAGES=en_US.iso885915   
 [7] LC_PAPER=en_US.iso885915       LC_NAME=C                     
 [9] LC_ADDRESS=C                   LC_TELEPHONE=C                
[11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C           

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] IRanges_1.5.16

loaded via a namespace (and not attached):
[1] tools_2.11.0



More information about the Bioconductor mailing list