Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c(ITime) and seq( ITime ) lose ITime attribute and coerce to integer #3628

Closed
UweBlock opened this issue Jun 5, 2019 · 0 comments · Fixed by #3630
Closed

c(ITime) and seq( ITime ) lose ITime attribute and coerce to integer #3628

UweBlock opened this issue Jun 5, 2019 · 0 comments · Fixed by #3630
Milestone

Comments

@UweBlock
Copy link
Contributor

UweBlock commented Jun 5, 2019

t1 <- seq(from = as.ITime("0:00"), to = as.ITime("0:40"), by = as.ITime("0:06"))
str(t1)
# int [1:7] 0 360 720 1080 1440 1800 2160

# workaround:
t2 <- as.ITime(seq(from = as.ITime("0:00"), to = as.ITime("0:40"), by = as.ITime("0:06")))
str(t2)
# 'ITime' int [1:7] 00:00:00 00:06:00 00:12:00 00:18:00 00:24:00 00:30:00 00:36:00

Ran into it while answering https://stackoverflow.com/a/56454903/3817004

Related issue: unique( ITime ) loses ITime attribute and coerces to integer ?

Just recognized that the same happens with c():

c(as.ITime("0:00"), as.ITime("1:00:00"))
# [1]    0 3600

Output of sessionInfo():

R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

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

other attached packages:
[1] magrittr_1.5      data.table_1.12.3

loaded via a namespace (and not attached):
[1] compiler_3.6.0  hms_0.4.2       tools_3.6.0     pkgconfig_2.0.2 rlang_0.3.4  
@UweBlock UweBlock changed the title seq( ITime ) loses ITime attribute and coerces to integer c(ITime) and seq( ITime ) lose ITime attribute and coerce to integer Jun 5, 2019
@mattdowle mattdowle added this to the 1.12.4 milestone Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants