Two things:

I think you are not aware of the R difference between a formula and a lm
object. A formula is part of the input to the lm function while the output
is a complicated object of lm class. If you want the formulas back from the
model object, you can access them by way of

model1$call with a little bit of string processing.

The other: nothing ever changes values of zzz (exactly the point of assign)
so it shouldn't surprise you it didn't change. What you may be looking for
is get(zzz)

Michael


On Fri, Sep 23, 2011 at 2:05 PM, Jim Bouldin <bouldi...@gmail.com> wrote:

> OK.  I was assuming that the call to zzz would print the model formulae,
> not the object names.  That's what threw me.
> Jim
>
>
> On Fri, Sep 23, 2011 at 1:59 PM, R. Michael Weylandt <
> michael.weyla...@gmail.com> wrote:
> assign() doesn't return anything in this case. It's your addtional
> (unnecessary?) call to "zzz" at the end which triggers a print statement.
>
> Michael
>
> On Fri, Sep 23, 2011 at 1:59 PM, R. Michael Weylandt <
> michael.weyla...@gmail.com> wrote:
>
>> assign() doesn't return anything in this case. It's your addtional
>> (unnecessary?) call to "zzz" at the end which triggers a print statement.
>>
>> Michael
>>
>>
>> On Fri, Sep 23, 2011 at 1:56 PM, Jim Bouldin <bouldi...@gmail.com> wrote:
>>
>>> OK, I see.  I thought R was just returning the character strings of the
>>> model names without doing any assigning, since that's what it displayed. I
>>> had it right all along. Thanks for your help.
>>>
>>>
>>> On Fri, Sep 23, 2011 at 1:45 PM, R. Michael Weylandt <
>>> michael.weyla...@gmail.com> wrote:
>>>
>>>> What exactly is the problem? Like I said, I'd personally put this in a
>>>> list, but this seems like exactly what you wanted...
>>>>
>>>> > model1
>>>>
>>>> Call:
>>>> lm(formula = y ~ x[, i])
>>>>
>>>> Coefficients:
>>>> (Intercept)       x[, i]
>>>>      1.0489       0.7175
>>>>
>>>> > model2
>>>>
>>>> Call:
>>>> lm(formula = y ~ x[, i])
>>>>
>>>> Coefficients:
>>>> (Intercept)       x[, i]
>>>>     -0.4342       0.8734
>>>>
>>>
>>>
>>
>
>
> --
> Jim Bouldin, PhD
> Research Ecologist
>
>
>
>

        [[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