The code
dt <- data.table(id=1:3, x=NA_character_, y=c('a', NA_character_, 'c'))
melt(dt, id.var='id', na.rm=TRUE)
produces in data.table v1.9.4
id variable value
1: 1 y a
2: 3 y c
but in data.table v.1.9.6 incorrectly returns
id variable value
1: 1 NA a
2: 3 NA c
It seems the bug only occurs when melt is called with na.rm=TRUE on a data.table with a column that purely consists of NA-values. Also note, that the bug does not occur, when the NA-column is the last column of the data.table.
The code
produces in data.table v1.9.4
but in data.table v.1.9.6 incorrectly returns
It seems the bug only occurs when
meltis called withna.rm=TRUEon a data.table with a column that purely consists of NA-values. Also note, that the bug does not occur, when the NA-column is the last column of the data.table.