[R] splitting a column of data into multiple columns

Janet Choate j@c@eco @end|ng |rom gm@||@com
Fri Jun 28 17:42:07 CEST 2019


Hello R community,
I have a data frame that has multiple observations in a single column that
I would like to break into multiple columns.
The data looks something like this:

scen trans evap flow
1       1.1    0.1    0.09
1       1.2    0.2    0.10
1       1.3    0.3    0.20
2       2.1    0.1    0.09
2       2.2    0.2    0.10
2       2.3    0.3    0.20
3       3.1    0.1    0.09
3       3.2    0.2    0.10
3       3.3    0.3    0.20

the column scen runs from 1 through 500, and each scen # contains 1461 rows
- i.e. there are 1461 observations for scen1, 1461 observations for scen2,
etc...
i want to split the trans, evap, and flow columns out by scen #, so that i
end up with something like:

trans1   trans2    trans3
1.1         2.1        1.1
1.2         2.2        3.2
1.3         2.3        3.3

and same for the other variables.
thought i could use the separate command to do this, but either not the
right approach or i am not executing it properly.
thank you for any assistance,
Janet
-- 
Tague Team Lab Manager
1005 Bren Hall
UCSB, Santa Barbara, CA.

	[[alternative HTML version deleted]]



More information about the R-help mailing list