[R] Issue with formula conversion

David Winsemius dwinsemius at comcast.net
Wed Aug 27 21:34:16 CEST 2014


On Aug 27, 2014, at 11:19 AM, Gang Chen wrote:

> A random effect formulation for R package nlme is read in as a string
> of characters from an input file:
> 
> ranEff <- "pdCompSymm(~1+Age)"
> 
> I need to convert 'ranEff' to a formula class. However, as shown below:
> 
>> as.formula(ranEff)
> ~1 + Age
> 
> the "pdCompSymm" is lost in the conversion. Any solutions? 

as.formula(paste("~",ranEff))
~pdCompSymm(~1 + Age)
-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list