Skip to content
Back to formatted view

Raw Message

Message-ID: <4.3.2.7.2.20020203020957.00ad2410@pop.ozemail.com.au>
Date: 2002-02-02T15:50:57Z
From: John Field
Subject: chron problem: extracting days and years

Hello r-help,

I'm trying to split a character vector of dates of the form "dd-mmm-yy" 
into component days, months and years. But

 > library(chron)
 > testdate<-as.POSIXlt(strptime("17-Sep-98","%d-%b-%y"))
 > testdate
[1] "1998-09-17"
 > months(testdate)
[1] "September"    # which is fine, but for days and years I get
 > days(testdate)
NULL
 > years(testdate)
NULL
 >

According to "?days" these should work.  What am I doing wrong?  Is there 
an easier way to achieve what I want?
(I'm running R1.3.0 under Win98).

Many thanks,
John Field

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._