Transpose data table

Hey there,

I have the following data table and I want to transpose it that way:



I tried by usind soming like this, but it doesn't work: <- data.table("date" = rep(dt.diff$date, ncol(dt.diff)-1), 
                         "daysAhead" = names(dt.diff)[-1], 
                         "deviation" = t(dt.diff[, 2:ncol(dt.diff)]))

Thank you :slight_smile:

Fast melt for data.table — • data.table (

Thanks, it works with:

melt(, id.vars = 1:1)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.