From bsaville at bios.unc.edu  Wed Apr 19 22:25:46 2006
From: bsaville at bios.unc.edu (bsaville at bios.unc.edu)
Date: Wed, 19 Apr 2006 22:25:46 +0200 (CEST)
Subject: [Rd] gsummary function (nlme library) (PR#8782)
Message-ID: <20060419202546.73ABF4423F@slim.kubism.ku.dk>

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]



[Rd] gsummary function (nlme library) (PR#8782)
bsaville at bios.unc.edu