On Thu, Nov 24, 2011 at 11:55 PM, Prof Brian Ripley
wrote:
> You would get exactly the same problem with ...,, anway.
>
> Here's a commonly used approach in R sources:
>
> x.lm <- function(formula, data, ...)
> {
> Call <- match.call(expand.dots = TRUE)
> Call[[1]] <- as.name("lm")
> Call
You would get exactly the same problem with ...,, anway.
Here's a commonly used approach in R sources:
x.lm <- function(formula, data, ...)
{
Call <- match.call(expand.dots = TRUE)
Call[[1]] <- as.name("lm")
Call$formula <- as.formula(terms(formula))
eval(Call)
}
On Thu, 24 No
On Thu, Nov 24, 2011 at 2:48 PM, Liviu Andronic wrote:
> Dear all
> I have a work-flow issue with lm(). When I use
>> lm(y1~x1, anscombe)
>
> Call:
> lm(formula = y1 ~ x1, data = anscombe)
>
> Coefficients:
> (Intercept) x1
> 3.0001 0.5001
>
>
> I get as expected the formula, "
On Thu, Nov 24, 2011 at 10:25 PM, Prof Brian Ripley
wrote:
> Yes. That's a job for substitute (the second time today).
>
>> form <- formula(y1~x1)
>> x <- eval(substitute(lm(f, anscombe), list(f = form)))
>> summary(x)
>
> Call:
> lm(formula = y1 ~ x1, data = anscombe)
>
That's what I wanted. Tha
On Thu, 24 Nov 2011, Liviu Andronic wrote:
On Thu, Nov 24, 2011 at 9:14 PM, Duncan Murdoch
wrote:
It is retained. terms(fit) will give it to you, if fit is an lm object.
Thank you. The following works nicely.
(form <- formula(y1~x1))
y1 ~ x1
x <- lm(form, anscombe)
formula(terms(x))
y1
On Thu, Nov 24, 2011 at 9:14 PM, Duncan Murdoch
wrote:
> It is retained. terms(fit) will give it to you, if fit is an lm object.
>
Thank you. The following works nicely.
> (form <- formula(y1~x1))
y1 ~ x1
> x <- lm(form, anscombe)
> formula(terms(x))
y1 ~ x1
However, I was hoping that there wa
On 24/11/2011 2:48 PM, Liviu Andronic wrote:
Dear all
I have a work-flow issue with lm(). When I use
> lm(y1~x1, anscombe)
Call:
lm(formula = y1 ~ x1, data = anscombe)
Coefficients:
(Intercept) x1
3.0001 0.5001
I get as expected the formula, "y1 ~ x1", in the print()ed
Dear all
I have a work-flow issue with lm(). When I use
> lm(y1~x1, anscombe)
Call:
lm(formula = y1 ~ x1, data = anscombe)
Coefficients:
(Intercept) x1
3.0001 0.5001
I get as expected the formula, "y1 ~ x1", in the print()ed results or
summary(). However, if I pass through
8 matches
Mail list logo