Monday, July 20, 2015

R reshape data.frame

df <- read.csv('data.txt', sep=' ')
l <- reshape(df, idvar="ID", varying = list(c("comp1","comp2","comp3"),c("
Num1","
Num2","Num3")), v.names = c("comp", "Num"), direction="long")


l <- reshape(df, direction="long", idvar=1,
             varying=c(c(2,4,6), c(3,5,7)), sep="")

No comments:

Post a Comment