
bySum
works like a very fast version of tapply with (weighted) FUN=sum
.
bySum(x, by, na.rm = FALSE, weight = NULL, ...)
numeric
vector to be summed
(list of) factor(s)
for which the sum will be calculated
logical
If TRUE
NA
values will be removed
numeric
with of same length as x
not used
array
with dimensions of by
# NOT RUN {
bySum(warpbreaks$breaks, warpbreaks$wool)
bySum(warpbreaks$breaks, warpbreaks[,-1])
# }
Run the code above in your browser using DataLab