Florian Hahne
2005-Apr-28 13:53 UTC
[R] strange behaviour of importFrom directive in name space
Dear listers, After activating the name space for my bioconductor package (prada) I successfully ran R CMD check. However when loading the package in R and running the examples the imported function brewer.pal from package RColorBrewer is not found. I can directly call brewer.pal from the RColorBrewer name space typing RColorBrewer::brewer.pal, but it is not imported into my prada name space. When I attach RColorBrewer, the example runs fine. For several other function from different packages the import works without problems. I'm quite puzzled how this import can work with R CMD check but not when attaching the package in a "regular" R session. And if the importFrom directive was corrupted, shouldn't there be an error message? This is not realy a problem, since I can load RColorBrewer by putting it into the dependent field in my DESCRIPTION file as I did before, but none the less I wanted to mention this strange behaviour. Could it be a bug? Regards, Florian Here is my NAMESPACE file: export("analysePlate", "as.all", "barploterrbar", "combineFrames", "csApply", "ddCt", "densCols", "eListWrite", "fitNorm2", "getPradaPar", "histStack", "plotNorm2", "plotPlate", "readCytoSet", "readFCS", "readSDM", "removeCensored", "setPradaPars", "smoothScatter", "thresholds") importFrom("KernSmooth", "bkde2D") importFrom("RColorBrewer", "brewer.pal") importFrom("utils", "getFromNamespace", "assignInNamespace") importFrom("MASS", "cov.rob") S3method("$", "cytoFrame") exportClasses("cytoFrame", "cytoSet") exportMethods("colnames", "colnames<-", "description", "description<-", "exprs", "exprs<-", "length", "[", "[[", "[[<-", "pData", "phenoData", "phenoData<-", "show") System: R 2.1.0 on Suse9.2 Linux box -- Florian Hahne <f.hahne at dkfz-heidelberg.de>
Duncan Murdoch
2005-Apr-28 20:03 UTC
[Rd] Re: [R] strange behaviour of importFrom directive in name space
This is really an R-devel question, and I've moved it there. Florian Hahne wrote:> Dear listers, > After activating the name space for my bioconductor package (prada) I > successfully ran R CMD check. However when loading the package in R and > running the examples the imported function brewer.pal from package > RColorBrewer is not found. I can directly call brewer.pal from the > RColorBrewer name space typing RColorBrewer::brewer.pal, but it is not > imported into my prada name space. When I attach RColorBrewer, the > example runs fine. For several other function from different packages > the import works without problems. > I'm quite puzzled how this import can work with R CMD check but not when > attaching the package in a "regular" R session. And if the importFrom > directive was corrupted, shouldn't there be an error message? > This is not realy a problem, since I can load RColorBrewer by putting it > into the dependent field in my DESCRIPTION file as I did before, but > none the less I wanted to mention this strange behaviour. Could it be a > bug?Could you be more specific about the bug? Which example fails? Is it run by the R CMD check tests? Generally, I wouldn't expect "importFrom" to be sufficient to make an example using the import work, either during Rcmd CHECK or in the console. It makes the import available from within your package, but examples are run in the global environment. Duncan Murdoch> Regards, > Florian > > Here is my NAMESPACE file: > export("analysePlate", "as.all", > "barploterrbar", "combineFrames", > "csApply", "ddCt", > "densCols", "eListWrite", > "fitNorm2", "getPradaPar", > "histStack", "plotNorm2", > "plotPlate", "readCytoSet", > "readFCS", "readSDM", > "removeCensored", "setPradaPars", > "smoothScatter", "thresholds") > > > importFrom("KernSmooth", "bkde2D") > importFrom("RColorBrewer", "brewer.pal") > importFrom("utils", "getFromNamespace", "assignInNamespace") > importFrom("MASS", "cov.rob") > S3method("$", "cytoFrame") > exportClasses("cytoFrame", "cytoSet") > exportMethods("colnames", "colnames<-", > "description", "description<-", > "exprs", "exprs<-", > "length", "[", "[[", "[[<-", > "pData", "phenoData", "phenoData<-", > "show") > > System: > R 2.1.0 on Suse9.2 Linux box > >