Hi, thank a lot for your answers!
As other people get the correct result but I get this mysterious result with this script even after running it on a freshly started R, it must be a problem with my particular R setup. I'll try updating. Thanks for the help, now I know where I have to search. Werner --- Søren Højsgaard <[EMAIL PROTECTED]> schrieb: > I'd be glad to help, but I don't think I understand > the problem. Here's what I get: > > x <- > as.data.frame(matrix(ncol=3,seq(1,12),dimnames=list(c(),c("hh","total","total.inf")))) > > x > hh total total.inf > 1 1 5 9 > 2 2 6 10 > 3 3 7 11 > 4 4 8 12 > > summaryBy(total+total.inf~hh,x,FUN=sum) > hh total.sum total.inf.sum > 1 1 5 9 > 2 2 6 10 > 3 3 7 11 > 4 4 8 12 > > Looks as expected to me. > > Regards > Søren Højsgaard > > > > -----Oprindelig meddelelse----- > Fra: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] På vegne > af Werner Wernersen > Sendt: 27. august 2007 15:21 > Til: r-help@stat.math.ethz.ch > Emne: Re: [R] Column naming mystery > > Sorry that the problem description was not > sufficient. > Here is a self-contained code replicating the > problem: > > require(doBy) > x <- > as.data.frame(matrix(ncol=3,seq(1,12),dimnames=list(c(),c("hh","total","total.inf")))) > summaryBy(total+total.inf~hh,x,FUN=sum) > > What surprises me are the zeros in the resulting > total.sum column. The problem remains if total.inf > is renamed to totalinf or total_inf but not if > renamed to ttotal.inf . > > Can anyone explain to me what the rules for naming > columns are so that I can avoid such mistakes in the > future? > > Thanks a lot! > > > ________ > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.