You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require(data.table)
DT= data.table(id=1:5, a=6:10, b=11:15, c=letters[1:5])
# expected resultans# id variable1 value1 variable2 value2# 1: 1 a 6 c a# 2: 2 a 7 c b# 3: 3 a 8 c c# 4: 4 a 9 c d# 5: 5 a 10 c e# 6: 1 b 11 c a# 7: 2 b 12 c b# 8: 3 b 13 c c# 9: 4 b 14 c d #10: 5 b 15 c e
all elements in measure.var list are of same length and the columns we've to melt is of different type (ex: integer and character). Currently it'll all be coerced to the same type depending on hierarchy into one value column.
Similarly, cast should also be able to operate on multiple columns so that unnecessary melting can be completely avoided. But that's another FR for next release (1.9.6) #739.
The text was updated successfully, but these errors were encountered:
@brodieG thanks. The examples in ?melt cover this quite well, I believe (feedbacks welcome). That was just for me to get a better picture. On your example, right. That was one of the main reasons I wanted to implement this.
As an experiment so far.
Idea:
This is particularly useful when:
measure.var
list are of same length and the columns we've to melt is of different type (ex: integer and character). Currently it'll all be coerced to the same type depending on hierarchy into onevalue
column.Similarly,
cast
should also be able to operate on multiple columns so that unnecessary melting can be completely avoided. But that's another FR for next release (1.9.6) #739.The text was updated successfully, but these errors were encountered: