Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ unit = "s")

7. Added more explanation/examples to `?data.table` for how to use `.BY`, [#1363](https://github.com/Rdatatable/data.table/issues/1363).

8. Change of `c.POSIXct` method planned for R 4.1.0 impacted `foverlaps` function that could raise `'origin' must be supplied` error. Fix for planned change has been provided in [#4428](https://github.com/Rdatatable/data.table/pull/4428).


# data.table [v1.12.8](https://github.com/Rdatatable/data.table/milestone/15?closed=1) (09 Dec 2019)

Expand Down
3 changes: 2 additions & 1 deletion R/foverlaps.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ foverlaps = function(x, y, by.x=if (!is.null(key(x))) key(x) else key(y), by.y=k
setattr(icall, 'names', icols)
mcall = make_call(mcols, quote(c))
if (type %chin% c("within", "any")) {
if (isposix) mcall[[2L]] = call("unclass", mcall[[2L]]) # fix for R-devel change in c.POSIXct
mcall[[3L]] = substitute(
# datetimes before 1970-01-01 are represented as -ve numerics, #3349
if (isposix) unclass(val)*(1L + sign(unclass(val))*dt_eps())
Expand All @@ -128,7 +129,7 @@ foverlaps = function(x, y, by.x=if (!is.null(key(x))) key(x) else key(y), by.y=k
within =, equal = yintervals)
call = construct(head(ynames, -2L), uycols, type)
if (verbose) {last.started.at=proc.time();cat("unique() + setkey() operations done in ...");flush.console()}
uy = unique(y[, eval(call)])
uy = unique(y[, eval(call)]) # this started to fail from R 4.1 due to c(POSIXct, numeric)
setkey(uy)[, `:=`(lookup = list(list(integer(0L))), type_lookup = list(list(integer(0L))), count=0L, type_count=0L)]
if (verbose) {cat(timetaken(last.started.at),"\n"); flush.console()}
matches = function(ii, xx, del, ...) {
Expand Down