Skip to content
Prev 347439 / 398498 Next

sum of grouped elements of vector

Hi Kathryn,
another solution would be to use tapply function. So the code to
create new1 vector would be:

a <- 1:8
fc <- c('g1','g1','g2','g3','g3','g3','g4','g4') # definitions of
groups to sum over
tapply(a,fc,sum)

ivan
On Fri, Jan 23, 2015 at 10:32 AM, Bert Gunter <gunter.berton at gene.com> wrote: