[R] Not sure if this is "aggregate" or some other task.

From: David L. Van Brunt, Ph.D. <dlvanbrunt_at_gmail.com>
Date: Mon 16 May 2005 - 06:27:38 EST


I have data where where I've taken some measurements three times... twice in rapid succession so I could check test-retest reliability of a piece of equipment, and then a third measurement some time later.

Not I'd like to do an analysis where I have two scores... the first being the mean of the first two taken the same day, and the second being the one taken later.

I have a lot of other variables in the row, and I'd like to do the same thing to all of them. Soo....

Data.Frame:

Subj Obs MeasureA MeasureB
1 1 45 685
1 2 50 690
1 3 48 693
2 1 39 595
2 2 41 585
2 3 45 343

should become:
Subj Obs MeasureA MeasureB
1 1 47.5 687.5
1 2 50 690
2 1 40 590
2 2 41 585

It seems like a job for "aggregate", but I want to collapse on only cases where observation # < 3, and take the mean of a few vars in the aggregation. I can't seem to make it work, and didn't find examples that were on the mark. I think I'm suffering from "prospective interference" and my SPSS syntax knowledge to do exactly this is just getting in my way.

any volunteers? I'd very grateful. Thanks!

-- 
---------------------------------------
David L. Van Brunt, Ph.D.
mailto:dlvanbrunt@gmail.com

	[[alternative HTML version deleted]]

______________________________________________
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
Received on Mon May 16 06:33:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST