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

From: <bsaville_at_bios.unc.edu>
Date: Wed 19 Apr 2006 - 20:25:46 GMT

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

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]

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Apr 20 06:33:41 2006

This archive was generated by hypermail 2.1.8 : Thu 20 Apr 2006 - 20:18:01 GMT