[R] my failing understanding ...

David Winsemius dwinsemius at comcast.net
Sat Nov 28 04:00:14 CET 2009


On Nov 27, 2009, at 9:39 PM, David Winsemius wrote:

> I get a different result, undoubtedly because I have different  
> packages loaded:
>
> > showMethods(plot)
>
> Function "plot":
> <not a generic function>
>
> > sessionInfo()
> R version 2.10.0 Patched (2009-10-29 r50258)
> x86_64-apple-darwin9.8.0
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] splines   stats     graphics  grDevices utils     datasets   
> methods   base
>
> other attached packages:
> [1] plm_1.2-1        sandwich_2.2-1   zoo_1.5-8         
> MASS_7.3-3       Formula_0.2-0
> [6] kinship_1.1.0-23 lattice_0.17-26  nlme_3.1-96      survival_2.35-7
>
> loaded via a namespace (and not attached):
> [1] grid_2.10.0  tools_2.10.0
>
> But I get a much longer and informative result with:
>
> methods(plot)
>

As  follow-up, I loaded lme4 (just guessing that was the package that  
was being used) and looked up merMCMC in R-search, finding that such  
objects were created with mcmcsamp. (I also noted that the methods  
available for such objects did NOT include plot, but they did include  
xyplot. So I made the sample object that is in the help page, and  
applied both plot and xyplot:

 > xyplot(samp0)  # plotted what I would expect from an MCMC object
 > plot(samp0)
Error in as.double(y) :
   cannot coerce type 'S4' to vector of type 'double'
 > plot(x=samp0)
Error in as.double(y) :
   cannot coerce type 'S4' to vector of type 'double'

So my (posterior) hypothesis is that you are using the wrong plot  
function.

-- 
David.


> -- 
> David.
>
> On Nov 27, 2009, at 4:23 PM, Kjetil Halvorsen wrote:
>
>> The following I do not understand, but then I did'nt really use
>> S4 methods ...
>>
>>> showMethods(plot)
>> Function: plot (package graphics)
>> x="ANY"
>> x="lmList.confint"
>> x="merMCMC"
>>   (inherited from: x="ANY")
>>
>>> plot(x=moda0MCMC)
>> Error in as.double(y) :
>> cannot coerce type 'S4' to vector of type 'double'
>>> class(moda0MCMC)
>> [1] "merMCMC"
>> attr(,"package")
>> [1] "lme4"
>>
>>
>> Kjetil
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list