-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of jimdare
Sent: Friday, 6 November 2009 2:54 p.m.
To: r-help at r-project.org
Subject: [R] Calculate Mean for each Treatment/Trial Interaction in DF
Hi,
I am create a new DF that summarizes the mean angle per
treatment/trial, of the original DF (see below). I have had
some success using:
(tapply(df$Angle, INDEX=interaction(df$State, df$Trial),
FUN=mean)); however, this gives the answer as a list, which
means I would have to split the name to get the categories back. Does
anyone know a simple way to transform the Original DF into
Summary DF?
Thanks in advance,
James
Original DF
Angle Trial Treatment
1 43.1297 1 C
2 62.3613 1 C
3 88.2767 2 C
4 75.2431 2 C
5 91.3668 3 C
6 61.2800 3 C
7 55.5575 1 U
8 69.4661 1 U
9 67.5512 2 U
10 95.5528 2 U
11 75.8689 3 U
12 66.9070 3 U
Summary DF