FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`shift` converts date to 1970-01-01 when converting to timestamp · Issue #5218 · Rdatatable/data.table · GitHub

shift converts date to 1970-01-01 when converting to timestamp #5218

Description

I realise this is down to using a date for filling the shift rather than a timestamp, but the behaviour is unexpected and thought best to flag. When using shift with timestamps and set a date as the fill argument (not necessarily Sys.Date()), the filled elements come back as 1st Jan 1970.

# Minimal reproducible example

library(data.table)
dates <- seq(Sys.time() - 5, Sys.time(), 1)
data.table::shift(dates, fill = Sys.Date())
[1] "1970-01-01 06:15:13 CET"  "2021-10-13 12:17:23 CEST" "2021-10-13 12:17:24 CEST" "2021-10-13 12:17:25 CEST"
[5] "2021-10-13 12:17:26 CEST" "2021-10-13 12:17:27 CEST"

# Output of sessionInfo()

R version 3.5.2 (2018-12-20)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.4 (Maipo)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.14.2

loaded via a namespace (and not attached):
[1] compiler_3.5.2 tools_3.5.2    yaml_2.2.1  

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL