Does this do what you want?
> x <- " vara varb S PC
+ 1 None 250 1 80
+ 2 None 250 1 70
+ 3 Some 250 1 60
+ 4 Some 250 1 70
+ 5 None 1000 1 90
+ 6 None 1000 1 90
+ 7 Some 1000 1 80
+ 8 Some 1000 1 70
+ 9 None 250 2 100
+ 10 None 250 2 80
+ 11 Some 250 2 70
+ 12 Some 250 2 70
+ 13 None 1000 2 100
+ 14 None 1000 2 90
+ 15 Some 1000 2 50
+ 16 Some 1000 2 40"> x.in <- read.table(textConnection(x), header=TRUE)
> (x.agg <- aggregate(x.in$PC, list(vara=x.in$vara, varb=x.in$varb,
Sx.in$S), mean))
vara varb S x
1 None 250 1 75
2 Some 250 1 65
3 None 1000 1 90
4 Some 1000 1 75
5 None 250 2 90
6 Some 250 2 70
7 None 1000 2 95
8 Some 1000 2 45
On 3/15/07, Christopher Brown <c-b@asu.edu> wrote:>
> Hi,
>
> I have a data set that looks like this:
>
> > data
> vara varb S PC
> 1 None 250 1 80
> 2 None 250 1 70
> 3 Some 250 1 60
> 4 Some 250 1 70
> 5 None 1000 1 90
> 6 None 1000 1 90
> 7 Some 1000 1 80
> 8 Some 1000 1 70
> 9 None 250 2 100
> 10 None 250 2 80
> 11 Some 250 2 70
> 12 Some 250 2 70
> 13 None 1000 2 100
> 14 None 1000 2 90
> 15 Some 1000 2 50
> 16 Some 1000 2 40
>
> ...
>
> And so on. The last column is the dependent variable, and I have made
> the other columns factors. As you can see, there are multiple scores for
> each subject in each combination of conditions. How can I reduce the
> dataset so that there is only 1 score per subject, per condition, for
> further analysis? I can use tapply to get means, but I need a data.frame
> for analysis (aov). Any ideas?
>
> --
> Chris
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
[[alternative HTML version deleted]]