Re: [R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Matthieu Stigler
Yes, was wondering that other code line did not change so much :-) Thanks a lot! 2009/11/30 Gabor Grothendieck : > > > On Sun, Nov 29, 2009 at 9:16 AM, Gabor Grothendieck > wrote: >> >> By the way, if you really do want to create the formula anyways then: >> >>    ix <- 1:2 >>    left <- paste(n

Re: [R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Gabor Grothendieck
On Sun, Nov 29, 2009 at 9:16 AM, Gabor Grothendieck wrote: > By the way, if you really do want to create the formula anyways then: > >ix <- 1:2 >left <- paste(names(freeny)[ix], collapse = ",") >fo <- as.formula(paste("cbind(", left, ") ~ .")) >lm(fo, freeny) > > or possibly repla

Re: [R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Gabor Grothendieck
By the way, if you really do want to create the formula anyways then: ix <- 1:2 left <- paste(names(freeny)[ix], collapse = ",") fo <- as.formula(paste("cbind(", left, ") ~ .")) lm(fo, freeny) or possibly replace last line with: eval(substitute(lm(fo, freeny)) which will cause th

Re: [R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Matthieu Stigler
Gabor Grothendieck a écrit : Try this: ix <- 1:2 lm(as.matrix(freeny[ix]) ~., freeny[-ix]) clean and clever!!! Thanks a lot!! You really simplified the code!!! Just for curiosity, do you see why parse(eval)) was not working twice in same formula? thanks a lot!! Matthieu On Sun, Nov 29,

Re: [R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Gabor Grothendieck
Try this: ix <- 1:2 lm(as.matrix(freeny[ix]) ~., freeny[-ix]) On Sun, Nov 29, 2009 at 8:56 AM, Matthieu Stigler < matthieu.stig...@gmail.com> wrote: > Thanks for answering so fast!! > >> >> lm(freeny) >> > :-) > Ok that's working for the one equation case :-) Was example case... > > But now I

Re: [R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Matthieu Stigler
Thanks for answering so fast!! lm(freeny) :-) Ok that's working for the one equation case :-) Was example case... But now I want to have not only first column of freeny on the left but both first? And I don't know their names a priori... Thanks! On Sun, Nov 29, 2009 at 8:49 AM, Matthie

Re: [R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Gabor Grothendieck
Try this: lm(freeny) On Sun, Nov 29, 2009 at 8:49 AM, Matthieu Stigler < matthieu.stig...@gmail.com> wrote: > Hi > > My goal is to do a (multiple) regression, just knowing that my Y variables > will be the say k first variables of a matrix/data frame. I thought I should > do it with eval(pars

[R] lm: eval(parse(text=)) works on one side y/x but not on both?

2009-11-29 Thread Matthieu Stigler
Hi My goal is to do a (multiple) regression, just knowing that my Y variables will be the say k first variables of a matrix/data frame. I thought I should do it with eval(parse)) but encounter a strange problem. See: lm(y~.-y, data=freeny) #that's what I want to do in the one equation case #P