Isn't necessary a formula, but a class that could be coerced to that class:

x <- rnorm(100)
y <- rnorm(100)
z <- rnorm(100)
lm("x ~ y + z")


On Sun, Jan 23, 2011 at 2:46 PM, Paul Evans <p.evan...@yahoo.com> wrote:

> Hi,
>
> I had a function that looked like:
>
> diff <- lm(x ~ y + z)
>
> How can I pass the argument to the 'lm' function on the fly? E.g., if I
> pass it
> in as a string (e.g. "x ~ y + z"), then the lm function treats it as a
> string
> and not a proper argument.
>
> many thanks
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to