Displaying 1 result from an estimated 1 matches for "var1summ".
2008 Jan 24
3
Reshaping a dataframe with conditional summary of columns - apply or reshape?
...example looks like this:
survey year count location var1 var2
1 1 2 A1 21.2 1
2 1 0 A1 15.6 1
3 1 29 A1 12.1 1
1 1 11 B3 9 2
3 1 5 B3 4.8 2
1 2 7 A2 20.1 4
2 2 2 A2 19.2 4
I need to rearrange it to look like this (the order of the columns is not
important):
location year survey1 survey2 survey3 var1summ var2
A1 1 1 0 2 16.3 1
B3 1 2 NA 1 6.9 2
A2 2 1 1 NA 19.7 4
The operations/conditions that I need are:
(A) The observations in "count" for each survey at each location in a given
year need to be reduced according to the following rules and then placed in
new columns "survey1"...