thomas.wainwright@noaa.gov
2006-Mar-08 22:17 UTC
[Rd] Error in return value for as.Date() (PR#8669)
Full_Name: Tom Wainwright Version: 2.2.1 (2005-12-20 r36812) OS: Linux (SuSE 9.3) Submission from: (NULL) (161.55.180.38) The as.Date function returns erroneous result for certain values using a day-of-year format. First an example that works (last day of 1970):> as.Date("1970.365", format="%Y.%j")[1] "1970-12-31" Next, a bad example (oops, 1970 wasn't a leap year). Incrementing day by one moves date ahead by 2 years 1 month:> as.Date("1970.366", format="%Y.%j")[1] "1972-01-31"> as.Date("1970.366", format="%Y.%j") - as.Date("1970.365", format="%Y.%j")Time difference of 396 days The second example should probably return an NA as this is an invalid date.