Skip to content
Prev 31630 / 398506 Next

Sum by categorical variable

If I understand correctly what you are looking for, see ?tapply.
Below there is a toy example
CategVar
 0  1
33 67
0        1
15.17833 32.11759

sum can be replaced by any function including mean, median, and
user-defined.
best,
vito


----- Original Message -----
From: "De Amicis Fabrizio (G.I.T.)" <Fabrizio.DeAmicis at git.generali.ch>
To: "'r-help at lists.R-project.org'" <r-help at stat.math.ethz.ch>
Sent: Tuesday, May 06, 2003 4:08 PM
Subject: [R] Sum by categorical variable
the
{{dropped}}