Re: [R] passing variable names to dplyr

2014-01-28 Thread David Winsemius
On Jan 28, 2014, at 3:43 PM, Dennis Murphy wrote: > David: > > I privately suggested he post to manipulatr because Hadley is more > likely to see his question there first than in R-help. He originally > posted here, noted the cross-posting and referral at manipulatr and > responded back to this

Re: [R] passing variable names to dplyr

2014-01-28 Thread Dennis Murphy
David: I privately suggested he post to manipulatr because Hadley is more likely to see his question there first than in R-help. He originally posted here, noted the cross-posting and referral at manipulatr and responded back to this list when he got a successful reply from Hadley. I don't see tha

Re: [R] passing variable names to dplyr

2014-01-28 Thread David Winsemius
On Jan 27, 2014, at 7:45 AM, Bos, Roger wrote: > All, > > I would like to figure out how to pass variable names to the dplyr function > mutate. For example, this works because hp is one of the variable names on > mtcars: > > mutate(mtcars, scale(hp)) > > Let's says I want to pass in the tar

Re: [R] passing variable names to dplyr - SOLVED

2014-01-28 Thread Bos, Roger
essage- From: arun [mailto:smartpink...@yahoo.com] Sent: Monday, January 27, 2014 5:25 PM To: Bos, Roger Subject: Re: [R] passing variable names to dplyr Hi Roger, This works on library(plyr), but not in dplyr. target <- "hp" res2 <- plyr:::mutate(mtcars,hp1= eval(parse(tex

[R] passing variable names to dplyr

2014-01-27 Thread Bos, Roger
All, I would like to figure out how to pass variable names to the dplyr function mutate. For example, this works because hp is one of the variable names on mtcars: mutate(mtcars, scale(hp)) Let's says I want to pass in the target variable instead of hard-coding the name, as follows: target