[R] Table rearranging

Jeffrey Joh johjeffrey at hotmail.com
Tue Feb 7 01:27:39 CET 2012


I have a table that looks like this:

measurement    date    door    color
0.93529385    513    open    red
0.97419293    420    open    red
0.962053514    513    closed    red
0.963909937    1230    open    blue
0.97652034    1230    open    green
0.989310795    1230    closed    blue
0.9941022    917    closed    yellow

I would like to create a table that has: Open measurement, Closed measurement, date, color.  For every date/color combination, there should be two columns to represent the door open/closed measurement.

If there are multiple datapoints with a given door/date/color combination, then they should be averaged.
I would also like to make two columns to represent the number of 
datapoints that were averaged in determining the open/closed 
measurements.

Jeffrey
 		 	   		  


More information about the R-help mailing list