[R] Different output type with as.Date
Barthelemy Tanguy
t@nguy@b@rthe|emy @end|ng |rom |n@ee@|r
Thu May 15 08:56:38 CEST 2025
Hello,
I'm encountering what seems to me to be an anomaly with the as.Date() function. If I fill in an origin or not, the function will not return the same type of object (integer or double).
Here's a small example:
``` r
as.Date(0L) |> typeof()
#> [1] "integer"
as.Date(0L, origin = "1970-01-01") |> typeof()
#> [1] "double"
```
Is it a bug or the intended behaviour? I don't see any mention of this in the documentation.
I'm working on R 4.5
Thank you!
Tanguy BARTHELEMY
More information about the R-help
mailing list