[R] strangeness in Predict() {rms}

William Dunlap wdunlap at tibco.com
Wed Feb 17 02:40:58 CET 2010


Both plyr and rms contain an object called ".".
In plyr it is a "closure" (the common kind of
function) and in rms is is NA.  If plyr is attached
in front of rms then you get your problem with
Predict(). 

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of 
> Bill.Venables at csiro.au
> Sent: Tuesday, February 16, 2010 4:21 PM
> To: dylan.beaudette at gmail.com; r-help at r-project.org
> Subject: Re: [R] strangeness in Predict() {rms}
> 
> This works without a glitch on my linux system (info below).  
> You might try upgrading your R to 2.10.1, perhaps.
> 
> > sessionInfo()
> R version 2.10.1 (2009-12-14) 
> x86_64-unknown-linux-gnu 
> 
> locale:
>  [1] LC_CTYPE=en_AU.UTF-8       LC_NUMERIC=C              
>  [3] LC_TIME=en_AU.UTF-8        LC_COLLATE=en_AU.UTF-8    
>  [5] LC_MONETARY=C              LC_MESSAGES=en_AU.UTF-8   
>  [7] LC_PAPER=en_AU.UTF-8       LC_NAME=C                 
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
> [11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C       
> 
> attached base packages:
> [1] splines   grid      stats     graphics  grDevices utils   
>   datasets 
> [8] methods   base     
> 
> other attached packages:
> [1] rms_2.1-0       plyr_0.1.9      Design_2.3-0    Hmisc_3.7-0    
> [5] survival_2.35-9
> 
> loaded via a namespace (and not attached):
> [1] ASOR_0.1       cluster_1.12.1 lattice_0.18-3 tcltk_2.10.1 
>   tools_2.10.1  
> >  
> 
> 
> Bill Venables
> CSIRO/CMIS Cleveland Laboratories
> 
> 
> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Dylan Beaudette
> Sent: Wednesday, 17 February 2010 10:05 AM
> To: r-help at r-project.org
> Subject: [R] strangeness in Predict() {rms}
> 
> Hi,
> 
> Running the following example from ?Predict() throws an error 
> I have never 
> seen before:
> 
> set.seed(1)
> x1 <- runif(300)
> x2 <- runif(300)
> ddist <- datadist(x1,x2); options(datadist='ddist')
> y  <- exp(x1+ x2 - 1 + rnorm(300))
> f  <- ols(log(y) ~ pol(x1,2) + x2)
> p1 <- Predict(f, x1=., conf.type='mean')
> 
> Error in paste(nmc[i], "=", if (is.numeric(x)) format(x) else 
> x, sep = "") : 
>   cannot coerce type 'closure' to vector of type 'character'
> In addition: Warning message:
> In is.na(v) : is.na() applied to non-(list or vector) of type 
> 'closure'
> 
> Here is the output from sessionInfo()
> 
> R version 2.9.0 (2009-04-17) 
> i686-pc-linux-gnu 
> 
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLA
> TE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=
> en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREME
> NT=en_US.UTF-8;LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] grid      splines   stats     graphics  grDevices utils   
>   datasets 
> [8] methods   base     
> 
> other attached packages:
> [1] plyr_0.1.9         mgcv_1.5-5         RColorBrewer_1.0-2 
> nlme_3.1-94       
> [5] rms_2.1-0          Hmisc_3.7-0        survival_2.35-6    
> lattice_0.17-25   
> 
> loaded via a namespace (and not attached):
> [1] cluster_1.12.0
> 
> 
> Any ideas?
> Thanks!
> 
> Dylan
> 
> 
> -- 
> Dylan Beaudette
> Soil Resource Laboratory
> http://casoilresource.lawr.ucdavis.edu/
> University of California at Davis
> 530.754.7341
> 
> ______________________________________________
> 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.
> 
> ______________________________________________
> 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.
> 



More information about the R-help mailing list