I have data in long format and am trying to spread
data to long format group_by
an identifier. I have tried the solution posted here and and receive this error message Error in -x : invalid argument to unary operator
. I have also tried the solution posted here.
My dataset looks like this;
iden<-c(rep(1:25, 2), rep(26:50, 2))
group<-c(rep(5, 25), rep(20, 25), rep(-18, 25), rep(-80, 25))
value<-sample(100:5000, 100, replace=TRUE)
df<-data.frame(iden, group, value)
Please help me figure out how to get the data in wide format without duplicate identifiers (see attched image here for expected output).
For image of @Ronak Shah's answer see image here