[R] as.character() problem?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Dec 4 17:10:42 CET 2000


> Date: Mon, 4 Dec 2000 15:56:44 +0000 (GMT)
> From: Simon Wood <snw at mcs.st-and.ac.uk>
> To: r-help at stat.math.ethz.ch
> Subject: [R] as.character() problem?
> 
> The following is pasted from 1.1.0 under Windows NT (same thing happens
> under linux). The problem is that part of the model formula is lost when
> coerced to character. Is this supposed to happen?
> 
> >reg.form<- formula(y~ lat + lon + depth + sunel + btmtemp + btmsal +
> sediment + sediment*sunel + lon*lat)
> > reg.form
> y ~ lat + lon + depth + sunel + btmtemp + btmsal + sediment + 
>     sediment * sunel + lon * lat
> > as.character(reg.form)
> [1] "~"                                                                    
> [2] "y"                                                                    
> [3] "lat + lon + depth + sunel + btmtemp + btmsal + sediment + sediment *"

Yes.  I think you wanted deparse(reg.form): a formula has mode "call"
and is an expression (more or less).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list