I have been trying to convert my data from a vertical configuration to a horizontal configuratoin. Using spread (), I have managed to get it in the following structure:
plot, x1, x2, x3, x4, x5, x6, x7
1 0.06011071 NA NA NA NA NA NA
1 NA 0.09756118 NA NA NA NA NA
1 NA NA NA NA 0.143701 NA NA
1 NA NA NA NA NA 0.1584451 NA
1 NA NA NA 0.1809486 NA NA NA
1 NA NA NA NA NA NA 0.1151581
1 NA NA -0.1422974 NA NA NA NA
7 rows
However, obviously I want to fill in the NAs with the information from the other rows. Then my data would look like
plot , x1, x2, x3, x4, x5, x6, x7
1 0.06011071 0.09756118 -0.1422974NA 0.1809486 0.143701 0.1584451 0.1151581
I have tried multiple approaches but thus far unsuccesfull. Does anyone know how I could achieve this?