diff --git a/R/IDateTime.R b/R/IDateTime.R index abbf485c1..6adba1dd0 100644 --- a/R/IDateTime.R +++ b/R/IDateTime.R @@ -24,12 +24,14 @@ seq.IDate <- c.IDate <- rep.IDate <- split.IDate <- -as.list.IDate <- unique.IDate <- function(x, ...) { as.IDate(NextMethod()) } +# fix for #1315 +as.list.IDate <- function(x, ...) NextMethod() + # rounding -- good for graphing / subsetting ## round.IDate <- function (x, digits, units=digits, ...) { ## if (missing(digits)) digits <- units # workaround to provide a units argument to match the round generic and round.POSIXt diff --git a/README.md b/README.md index bcc5d62a9..50922b5f7 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,8 @@ 66. Evaluating quoted expressions with `.` in `by` works as intended. That is, `dt = data.table(a=c(1,1,2,2), b=1:4); expr=quote(.(a)); dt[, sum(b), eval(expr)]` works now. Closes [#1298](https://github.com/Rdatatable/data.table/issues/1298). Thanks @eddi. + 67. `as.list` method for `IDate` object works properly. Closes [#1315](https://github.com/Rdatatable/data.table/issues/1315). Thanks to @gwerbin. + #### NOTES 1. Clearer explanation of what `duplicated()` does (borrowed from base). Thanks to @matthieugomez for pointing out. Closes [#872](https://github.com/Rdatatable/data.table/issues/872). diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 8eecd8a9d..fcbcc474e 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -6974,6 +6974,11 @@ d = data.table(a = 1) q = quote(.(a)) test(1561, d[, 1, by = eval(q)], d[, 1, by = .(a)]) +# Fix for #1315 +d = as.IDate(seq(as.Date("2015-01-01"), as.Date("2015-01-15"), by='1 day')) +test(1562.1, as.list(d), lapply(as.list(as.Date(d)), as.IDate)) +test(1562.2, sapply(d, identity), as.integer(sapply(as.Date(d), identity))) + ##########################