Re: [R] How to translate string to variable inside a command in an easy way in R

2011-07-14 Thread Ivan Calandra
Hi! What about as.forumla()? Like this: form - as.formula(paste(num, y, ~MemberID, sep=)) agg-aggregate(form, right.a, sum) Would it work as you expect to? HTH, Ivan Le 7/13/2011 19:30, Daniel Nordlund a écrit : -Original Message- From: r-help-boun...@r-project.org

Re: [R] How to translate string to variable inside a command in an easy way in R

2011-07-13 Thread UriB
Greg Snow-2 wrote: You are suffering from the fact that the longest distance between 2 points is a shortcut. The df$column notation is a shortcut for df[[column]] that has some nice properties, but the shortcut gets in the way when you want to do something more structured. Try qq1[[z]]==y and

Re: [R] How to translate string to variable inside a command in an easy way in R

2011-07-13 Thread Sarah Goslee
Hi, On Wed, Jul 13, 2011 at 7:03 AM, UriB uribl...@gmail.com wrote: Greg Snow-2 wrote: You are suffering from the fact that the longest distance between 2 points is a shortcut. The df$column notation is a shortcut for df[[column]] that has some nice properties, but the shortcut gets in the

Re: [R] How to translate string to variable inside a command in an easy way in R

2011-07-13 Thread UriB
Thanks Here is another question I want to have a function that get a string for example y=AMI and make commands like the following agg-aggregate(numAMI ~MemberID,right.a,sum) Note that I know that numAMI is part of right.a because another function with the string AMI already generated it. Is

Re: [R] How to translate string to variable inside a command in an easy way in R

2011-07-13 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of UriB Sent: Wednesday, July 13, 2011 9:28 AM To: r-help@r-project.org Subject: Re: [R] How to translate string to variable inside a command in an easy way in R Thanks Here is

[R] How to translate string to variable inside a command in an easy way in R

2011-07-05 Thread UriB
I want to write a function that get 2 strings y and z and does the following R command. temp-qq1[qq1$z==y,] for example if it get y=AMI and z=PrimaryConditionGroup It should do the following temp-qq1[qq1$PrimaryConditionGroup==AMI,] I could do it by the following function that is ugly and I

Re: [R] How to translate string to variable inside a command in an easy way in R

2011-07-05 Thread Greg Snow
You are suffering from the fact that the longest distance between 2 points is a shortcut. The df$column notation is a shortcut for df[[column]] that has some nice properties, but the shortcut gets in the way when you want to do something more structured. Try qq1[[z]]==y and avoid all that