Werner Wernersen
2007-Aug-20 16:13 UTC
[R] Problem mit summaryBy: Group sums gives me "incorrectly" zero for one variable
Hi, first I want to thank all of you for the quick aid which is provided here on the list during all times. Thanks a lot for that! Then, I have a problem using summaryBy which most probably is a problem of wrong use by me or the like: I use this command: summaryBy(total+total.inf~gr, aE, FUN=sum) where aE is a> str(aE)'data.frame': 127880 obs. of 16 variables: $ gr : num 2.02e+10 1.13e+10 2.15e+10 4.02e+10 1.04e+10 ... $ total : num 187714 5214 5214 260714 1304 ... $ total.inflated: num 188806 5245 5245 262230 1311 ... .. .. .. Now, the resulting sum for total.inf per gr is perfectly fine but for the sum for total per gr I get only zeroes although they shouldn't be zero. Has anybody experienced a similar problem? What am I doing wrong? Thank you very much for your help, Werner
Werner Wernersen
2007-Aug-20 17:25 UTC
[R] Problem mit summaryBy: Group sums gives me "incorrectly" zero for one variable
Just an additional note: It must be a problem with the variable names. If I change "total.inf" to for instance "ttotal.inf" then it works as expected. What is the rule here? I would like to avoid such problems in the future. Thanks, Werner> Hi, > > first I want to thank all of you for the quick aid > which is provided here on the list during all times. > Thanks a lot for that! > > Then, I have a problem using summaryBy which most > probably is a problem of wrong use by me or the > like: > > I use this command: > summaryBy(total+total.inf~gr, aE, FUN=sum) > > where aE is a > > str(aE) > 'data.frame': 127880 obs. of 16 variables: > $ gr : num 2.02e+10 1.13e+10 2.15e+10 > 4.02e+10 1.04e+10 ... > $ total : num 187714 5214 5214 260714 > > 1304 ... > $ total.inflated: num 188806 5245 5245 262230 > > 1311 ... > . > . > . > > Now, the resulting sum for total.inf per gr is > perfectly fine but for the sum for total per gr I > get > only zeroes although they shouldn't be zero. > > Has anybody experienced a similar problem? What am I > doing wrong? > > Thank you very much for your help, > Werner >________