Skip to content
Prev 386785 / 398506 Next

non-standard reshape from long to wide

Hi

dcast from reshape is close, however column order is different

mydf <- dcast(df.long, sample~marker)
(!is.na(mydf[,-1]))*1
     g j k u x y
[1,] 1 0 1 0 1 0
[2,] 0 1 0 1 1 1
[3,] 0 0 0 0 1 1

You just need to change 0 to NA and add rownames from mydf.

Cheers
Petr
marker <-
<-data.frame(sample,
under
financial
the
or
and
via