Seems like it makes sense to have a default origin of 1970-01-01 for as.Date.numeric(). Are there any strong arguments for requiring users to specify the origin for every invocation of as.Date.numeric()?
The code could be: as.Date.numeric <- function(x, origin="1970-01-01", ...) { if ((missing(origin) && nargs()==1) || (is.character(origin) && origin=="1970-01-01" && nargs()==2)) return(structure(as.integer(x), class="Date")) as.Date(origin, ...) + as.integer(x) } I guess the use of as.integer(x) is debatable, but using it seems consistent with the "Details" section of ?Date. -- Tony Plate Jeff Ryan wrote: > R-devel, > > I would like to second Gabor Grothendieck's request from September ( > http://www.nabble.com/as.Date.numeric-to12962733.html#a12962733 ) > on adding a default value (1970-01-01) to the origin argument of > as.Date.numeric. > > I realize there is good reason to allow for origin to be specified, > but I don't see why it must be up to the user at each and every > invocation if most (if not all) users will simply be using 1970-01-01. > > My first contact was building quantmod for CRAN - many more hidden > errors occur as I test on R-devel. It just seems to me to be an easy > compromise to what will undoubtedly cost many hours of debugging > across all packages/users. > > Thank you for your consideration, > Jeff Ryan > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel