as.POSIXct.numeric change default of origin argument

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

as.POSIXct.numeric change default of origin argument

Jan Gorecki
Hello all,

I would like to propose to change the default value for "origin"
argument in as.POSIXct.numeric method, from current missing to new
"1970-01-01".
My proposal is motivated by the fact that this is the most commonly
needed value for "origin" argument and having that as a default seems
reasonable.
Proposed change seems to be pretty safe because it is now an error.

Best Regards,
Jan Gorecki

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: as.POSIXct.numeric change default of origin argument

Spencer Graves-3
          The fda package already includes as.POSIXct1970, which also sets
tz="GMT" by default.


          I made the equivalent thing for as.Date available as
"Ecfun::as.Date1970".


          If the Core R team doesn't want to make the change for the existing
functions, they might consider adding alternatives like this.  And, of
course, Jan Gorecki and others can use these (if they aren't already
using them or something equivalent).


          sg


On 2020-12-06 05:04, Jan Gorecki wrote:

> Hello all,
>
> I would like to propose to change the default value for "origin"
> argument in as.POSIXct.numeric method, from current missing to new
> "1970-01-01".
> My proposal is motivated by the fact that this is the most commonly
> needed value for "origin" argument and having that as a default seems
> reasonable.
> Proposed change seems to be pretty safe because it is now an error.
>
> Best Regards,
> Jan Gorecki
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: as.POSIXct.numeric change default of origin argument

Achim Zeileis-4
In reply to this post by Jan Gorecki
On Sun, 6 Dec 2020, Jan Gorecki wrote:

> Hello all,
>
> I would like to propose to change the default value for "origin"
> argument in as.POSIXct.numeric method, from current missing to new
> "1970-01-01".
> My proposal is motivated by the fact that this is the most commonly
> needed value for "origin" argument and having that as a default seems
> reasonable.
> Proposed change seems to be pretty safe because it is now an error.

I would also be in favor of this (and have been for years), mostly to make
it consistent with the as.numeric() method. Same for "Date".

To support the latter, the "zoo" package provides a separate as.Date()
generic that enables the as.Date.numeric() with different default.

The main argument of R Core against it is that it is too uncertain whether
the origin is really 1970-01-01, e.g., when importing from Excel or SAS.

Best wishes,
Z

> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: as.POSIXct.numeric change default of origin argument

Gabor Grothendieck
For example, this works:

  library(zoo)
  as.Date(0)
  ## [1] "1970-01-01"

On Sun, Dec 6, 2020 at 7:10 AM Achim Zeileis <[hidden email]> wrote:

>
> On Sun, 6 Dec 2020, Jan Gorecki wrote:
>
> > Hello all,
> >
> > I would like to propose to change the default value for "origin"
> > argument in as.POSIXct.numeric method, from current missing to new
> > "1970-01-01".
> > My proposal is motivated by the fact that this is the most commonly
> > needed value for "origin" argument and having that as a default seems
> > reasonable.
> > Proposed change seems to be pretty safe because it is now an error.
>
> I would also be in favor of this (and have been for years), mostly to make
> it consistent with the as.numeric() method. Same for "Date".
>
> To support the latter, the "zoo" package provides a separate as.Date()
> generic that enables the as.Date.numeric() with different default.
>
> The main argument of R Core against it is that it is too uncertain whether
> the origin is really 1970-01-01, e.g., when importing from Excel or SAS.
>
> Best wishes,
> Z
>
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel