I have tried to transform this data but I am quite new to R and would like some help on the below.
I used this code and it transforms the whole data.
attach(merged_file)
final_df <- as.data.frame(t(merged_file))
Any help would be really appreciated.
I have this original dataset that I want to transform:
Year AEZ 01-Jan 02-Jan 03-Jan 04-Jan 05-Jan
1981 1 0.025 0.025 0.025 0.025 0.025
1981 2 0.0049 0.0049 0.0049 0.0049 0.0049
1982 1 0.0251 0.0251 0.0251 0.0251 0.0251
1982 2 0.0049 0.0049 0.0049 0.0049 0.0049
The transformed data should look like this:
aez year day rainfall
1 1981 01-Jan 0.025
1 1981 02-Jan 0.025
1 1981 03-Jan 0.025
1 1981 04-Jan 0.025
1 1981 05-Jan 0.025
2 1981 01-Jan 0.0049
2 1981 02-Jan 0.0049
2 1981 03-Jan 0.0049
2 1981 04-Jan 0.0049
2 1982 05-Jan 0.0049
1 1982 01-Jan 0.0251
1 1982 02-Jan 0.0251
1 1982 03-Jan 0.0251
1 1982 04-Jan 0.0251
1 1982 05-Jan 0.0251
2 1982 01-Jan 0.0049
2 1982 02-Jan 0.0049
2 1982 03-Jan 0.0049
2 1982 04-Jan 0.0049
2 1982 05-Jan 0.0049