From risso.davide at gmail.com  Wed Feb 18 21:19:33 2015
From: risso.davide at gmail.com (davide risso)
Date: Wed, 18 Feb 2015 12:19:33 -0800
Subject: [Rd] smoothScatter() and the KernSmooth package
Message-ID: <CAFySUMk3MkkpcvrwyZKtshXYZ+pQo+qVoTfNYnxweKA2kJpEjQ@mail.gmail.com>

Dear R-devel,

my Bioconductor EDASeq package has a function MDPlot that uses the
smoothScatter() function from the graphics package. When I test this
package on travis-ci.org (R CMD check) I get the following error
(which I don't get on my machine nor on the Bioconductor build
system).

* checking examples ... ERROR
Running examples in ?EDASeq-Ex.R? failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: MDPlot-methods
> ### Title: Methods for Function 'MDPlot' in Package 'EDASeq'
> ### Aliases: MDPlot MDPlot-methods MDPlot,matrix,numeric-method
> ###   MDPlot,SeqExpressionSet,numeric-method
> ### Keywords: methods
>
> ### ** Examples
>
> library(yeastRNASeq)
> data(geneLevelData)
> data(yeastGC)
>
> sub <- intersect(rownames(geneLevelData), names(yeastGC))
>
> mat <- as.matrix(geneLevelData[sub,])
>
> data <- newSeqExpressionSet(mat,
+             phenoData=AnnotatedDataFrame(
+                       data.frame(conditions=factor(c("mut", "mut",
"wt", "wt")),
+                                  row.names=colnames(geneLevelData))),
+             featureData=AnnotatedDataFrame(data.frame(gc=yeastGC[sub])))
>
> MDPlot(data,c(1,3))
Error in loadNamespace(name) : there is no package called ?KernSmooth?
Calls: MDPlot ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

I looked at the code in smoothScatter and there is a call to
grDevices:::.smoothScatterCalcDensity(), which in turn calls
KernSmooth::bkde2D().

This gets fixed by adding KernSmooth as suggested package in EDASeq.

I was able to reproduce this issue (and the fix) in a small R package:
https://github.com/drisso/rmini/tree/smooth

I have a few questions: isn't it unusual the way smoothScatter calls
grDevices:::.smoothScatterCalcDensity() and KernSmooth::bkde2D(),
i.e., without requiring the packages?
Shouldn't "graphics" suggest "KernSmooth"?

Best regards,
Davide




-- 
Davide Risso, PhD
Post Doctoral Scholar
Division of Biostatistics
School of Public Health
University of California, Berkeley
344 Li Ka Shing Center, #3370
Berkeley, CA 94720-3370
E-mail: davide.risso at berkeley.edu



[Rd] smoothScatter() and the KernSmooth package
davide risso