[datatable-help] Change in list( ) behavior inside join

Shir Levkowitz levkowitz at dc-energy.com
Mon Mar 24 20:37:49 CET 2014


It looks like the latest version of data.table has changed the behavior of list( ) inside of a join - is this behavior as expected? Has anyone reported or encountered this change? It seems like a bug to me. I am using data.table v1.9.2 in R 3.2.0 .

Thanks,
Shir Levkowitz





#-----------------------------------------------


library(data.table)

# dates
dt.dateEx <- data.table(date = as.character(seq(as.Date('2014-04-01'), as.Date('2014-04-15'), by = 1)))
setkey(dt.dateEx, date)

# hours 
dt.hrEx <- copy(dt.dateEx)
dt.hrEx <- dt.hrEx[,  list(hour_beginning =0:23), by = list(dt = date)] # rep x24 per date
setkey(dt.hrEx, dt, hour_beginning)

# as expected
dt.classEx[dt.dateEx][, list(dt, hour_beginning)]

# not expected outcome
dt.classEx[dt.dateEx, list(hour_beginning)]



More information about the datatable-help mailing list