Re: [R] lm looking for weights outside of the user-defined function

2010-10-23 Thread William Dunlap
> From: David Winsemius [mailto:dwinsem...@comcast.net] > Sent: Friday, October 22, 2010 9:43 PM > To: William Dunlap > Cc: Dimitri Liakhovitski; r-help > Subject: Re: [R] lm looking for weights outside of the > user-defined function > > > On Oct 22, 2010, at 12:

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread David Winsemius
weights outside of the user-defined function On Oct 22, 2010, at 9:18 AM, Dimitri Liakhovitski wrote: David, I undersand - and I am sure what you are suggesting should work. But I just can't understand why it's not grabbing things INSIDE the environment of the formula first. I am not

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius > Sent: Friday, October 22, 2010 6:25 AM > To: Dimitri Liakhovitski > Cc: r-help > Subject: Re: [R] lm looking for weights outside of the &g

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread Dimitri Liakhovitski
As you suggested, David, the code below works. Now I it can find the weights - because they are in the data frame x. But how can I be sure now that it actually grabs the data from the data frame "variables" and not the data frame x? x<-data.frame(y=rnorm(100,0,1),a=rnorm(100,1,1),b=rnorm(100,2,1),

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread David Winsemius
On Oct 22, 2010, at 9:18 AM, Dimitri Liakhovitski wrote: David, I undersand - and I am sure what you are suggesting should work. But I just can't understand why it's not grabbing things INSIDE the environment of the formula first. I am not sure that either one of us understand what is meant b

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread Dimitri Liakhovitski
David, I undersand - and I am sure what you are suggesting should work. But I just can't understand why it's not grabbing things INSIDE the environment of the formula first. I've already tried to define the weights outside of the function - and it finds them. But shouldn't it go in this order? 1.

Re: [R] lm looking for weights outside of the user-defined function

2010-10-22 Thread David Winsemius
On Oct 22, 2010, at 9:01 AM, Dimitri Liakhovitski wrote: Dear R'ers, I am fighting with a problem that is driving me crazy. I use "lm" in my user-defined function, but it seems to be looking for weights outside of my function's environment: ### Generating example data: x<-data.frame(y=rnorm(1

[R] lm looking for weights outside of the user-defined function

2010-10-22 Thread Dimitri Liakhovitski
Dear R'ers, I am fighting with a problem that is driving me crazy. I use "lm" in my user-defined function, but it seems to be looking for weights outside of my function's environment: ### Generating example data: x<-data.frame(y=rnorm(100,0,1),a=rnorm(100,1,1),b=rnorm(100,2,1)) myweights<-runif(1