I am trying to convert data from long format to wide format using spread function in R, it works but not correctly and transforms dataset wrongly.
dbv_fc1<-read.csv("dbtest_forum.csv",header = TRUE,na.strings=0)
data_new <- dbv_fc1 %>% spread(test, value)
My dataset contains four columns
But when it does the transforming into wide format on the basis of just two columns, it moved values of tests with same dates into new rows rather than same row but in respective columns as shown below.
It shows that in ID A6 where dates are same it moves values into next row of corresponding column which I don't want.