Re: [R] Passing variable names in quotes to a function

2015-12-02 Thread Brant Inman
Thank you for your response. Here is the problem that I find with your code (which I had tried). When you pass a value to the subset argument of the function, it will not hold the quotes on the subsetting variable’s value. For example, if I want the function to do Y[Z==‘skinny’] so that we

Re: [R] Passing variable names in quotes to a function

2015-12-02 Thread phgrosjean
> On 02 Dec 2015, at 16:09, Brant Inman wrote: > > Thank you for your response. Here is the problem that I find with your code > (which I had tried). When you pass a value to the subset argument of the > function, it will not hold the quotes on the subsetting variable’s

Re: [R] Passing variable names in quotes to a function

2015-12-02 Thread phgrosjean
Your example and explanation are not complete, but I have the gut feeling that you could do all this both more efficiently *and* more R-ish. First of all, why would you pass Y and X separately, to ultimately build the Y ~ X formula within the body of your function? Secondly, it seems to me

Re: [R] Passing variable names in quotes to a function

2015-12-01 Thread Uwe Ligges
On 02.12.2015 06:11, Brant Inman wrote: I am trying to build a function that can accept variables for a regression. It would work something like this: --- # Y = my response variable (e.g. income) # X = my key predictor variable (e.g. education) # subY = a subsetting variable for Y (e.g.

[R] Passing variable names in quotes to a function

2015-12-01 Thread Brant Inman
I am trying to build a function that can accept variables for a regression. It would work something like this: --- # Y = my response variable (e.g. income) # X = my key predictor variable (e.g. education) # subY = a subsetting variable for Y (e.g. race) # subY.val = the value of the subsetting