[R] splitting columns into groups

Jeremy Z Butler jeremybutler at paradise.net.nz
Thu Dec 12 04:07:03 CET 2002


Hi,
I'm trying to split 96 columns into 8 groups and then obtain row totals for each
of those groups. But:

c.factor <- as.factor(c(rep(1:8,c(18,12,12,12,6,12,12,12)))
data.groups <- split(data,c.factor)

splits my rows into those groups. Is there anyway I can tell R to apply the
split function to columns or am I doing something wrong when creating "c.factor"

Cheers, Jeremy




More information about the R-help mailing list