Re: [R] as.formula doesn't want to take a phrase

From: Marc Schwartz <>
Date: Mon, 18 Apr 2011 14:54:02 -0500

On Apr 18, 2011, at 2:44 PM, Dimitri Liakhovitski wrote:

> Hello!
> I am trying to create a formula object using as.formula. But it's not working:
> examplephraze<-""
> myformula<-as.formula(paste(examplephraze,"~group, sum, data=mydata",sep=""))
> What's the problem?
> Thanks a lot!

The actual 'formula' part consists *only* of the actual model specification formula (LHS ~ RHS), not the additional arguments to a model function or other function that takes a formula as an argument (eg. boxplot()).


myformula <- as.formula(paste(examplephraze,"~group"))

> myformula ~ group

HTH, Marc Schwartz mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 18 Apr 2011 - 19:56:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Apr 2011 - 20:20:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive