The R Project SVN R

Rev

Rev 68948 | Rev 85953 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68948 Rev 77208
Line 45... Line 45...
45
  \code{x} has few columns.
45
  \code{x} has few columns.
46
 
46
 
47
  The original function was written by Terry Therneau, but this is a
47
  The original function was written by Terry Therneau, but this is a
48
  new implementation using hashing that is much faster for large matrices.
48
  new implementation using hashing that is much faster for large matrices.
49
 
49
 
50
  To sum over all the rows of a matrix (ie, a single \code{group}) use
50
  To sum over all the rows of a matrix (i.e., a single \code{group}) use
51
  \code{\link{colSums}}, which should be even faster.
51
  \code{\link{colSums}}, which should be even faster.
52
 
52
 
53
  For integer arguments, over/underflow in forming the sum results in
53
  For integer arguments, over/underflow in forming the sum results in
54
  \code{NA}.
54
  \code{NA}.
55
}
55
}
Line 66... Line 66...
66
tapply(x, list(group[row(x)], col(x)), sum)
66
tapply(x, list(group[row(x)], col(x)), sum)
67
t(sapply(split(as.data.frame(x), group), colSums))
67
t(sapply(split(as.data.frame(x), group), colSums))
68
aggregate(x, list(group), sum)[-1]
68
aggregate(x, list(group), sum)[-1]
69
}
69
}
70
\keyword{manip}
70
\keyword{manip}
71
 
-