[R] Unable to understand strptime() behaviour

Tim Churches tchur at optushome.com.au
Tue Nov 30 23:36:37 CET 2004

R V2.0.1 on Windows XP.

I have read the help pages on strptime() over and over, but can't
understand why strptime() is producing the following results.

   > v <- format("2002-11-31", format="%Y-%m-%d")
   > v
[1] "2002-11-31"
   > factor(v, levels=v)
[1] 2002-11-31
Levels: 2002-11-31
   > x <- strptime("2002-11-31", format="%Y-%m-%d")
   > x
[1] "2002-12-01"
   > factor(x, levels=x)
[1] <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
Levels: 2002-12-01 NA NA NA NA NA NA NA NA

Tim C

More information about the R-help mailing list