hadley/reshape — pull request #21 by vitoshka (2012-07-18 15:13:05+00:00)
Title: Make melt to preserve classes of measure variables when they are all the same.

I guess the most common usage case for melt is when all columns have the same class.

Currently melt downgrades classes. For example

df <- data.frame(id = 1:2, date1 = Sys.Date(), date2 = Sys.Date() + 10)
melt(df, measure.vars=c("date1", "date2"))

gives

id variable value
1 1 date1 15539
2 2 date1 15539
3 1 date2 15549
4 2 date2 15549

With this patch it produces:

id variable value
1 1 date1 2012-07-18
2 2 date1 2012-07-18
3 1 date2 2012-07-28
4 2 date2 2012-07-28