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. I

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 a

[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

Re: [R] How to build a matrix of number of appearance?

2011-07-05 Thread UriB
Thanks for your reply Note that I guess that there are many providerID and I get the error cannot allocate vector of size 2.1 Gb (I can use the same trick for most of the other fields) Is there a way to do the same only for providerID with relatively high frequency? -- View this message in contex

[R] How to build a matrix of number of appearance?

2011-07-04 Thread UriB
I have a matrix of claims at year1 that I get simply by claims<-read.csv(file="Claims.csv") qq1<-claims[claims$Year=="Y1",] I have MemberID and ProviderID for every claim in qq1 both are integers An example for the type of questions that I want to answer is how many times ProviderID number 345