I know this is rather simple for R users, but struggled to do this simple task:
I have this dataframe:
data
set.seed(123)
df <- data.frame(ID_series=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18),
year=c(2010,2011,2012,2010,2011,2012,2010,2011,2012,2010,2011,2012,
2010,2011,2012,2010,2011,2012),
IDPlot=c(1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2),
value=runif(18, 0.0, 1.0))
I would need:
- to split the dataframe by IDPlot
- rearrange it so that year is in rows and ID_series in columns
- save separate dataframes named by IDPlot in csv.
Thank you for suggestions! Michal