In many uses of cast I've seen, an aggregation function such as mean is used.
How about if you simply want to reshape without information loss. For example, if I want to take this long format:
ID condition Value
John a 2
John a 3
John b 4
John b 5
John a 6
John a 2
John b 1
John b 4
To this wide-format without any aggregation:
ID a b
John 2 4
John 3 5
Alex 6 1
Alex 2 4
I suppose that this is assuming that observations are paired and you were missing value would mess this up but any insight is appreciated
Alex
does not appear in the long format. 2. How do you know thata==2
andb==4
go together instead ofa==2
andb==5
or some other combination of the values? I'm guessing you are not showing a column that indicates an experiment or some other identifier... - Chase