[Rd] gsummary function (nlme library) (PR#8782)

bsaville at bios.unc.edu bsaville at bios.unc.edu
Wed Apr 19 22:25:46 CEST 2006


Full_Name: Ben Saville
Version: 2.1
OS: Windows XP
Submission from: (NULL) (152.2.94.145)


I'm using the gsummary function to calculate a sum of V1 (column one) from my
data 'mytest' by group (V2,or column 2).  If V1 (the variable of interest) is
all the same value (in this case all 2's), I do not get back the correct
summation.  If there is at least one difference in V1 (all 2's except for one
1), it gives me correct values.  So either I am doing something wrong or there
is a bug in the gsummary function.  

   # Incorrect sums
mytest <- as.data.frame(matrix(c(2,rep(2,8),1,1,2,2,2,3,3,3,3),ncol=2))
mytest
gsummary(mytest,form=V1~1|V2, FUN=sum)[,1]

   # Correct sums
mytest <- as.data.frame(matrix(c(1,rep(2,8),1,1,2,2,2,3,3,3,3),ncol=2))
mytest
gsummary(mytest,form=V1~1|V2, FUN=sum)[,1]



More information about the R-devel mailing list