Message-ID: <AANLkTinvYyoLbbr8CijitLVHz2OzqdgA93ffgGB+q9qx@mail.gmail.com>
Date: 2010-10-13T20:20:28Z
From: Gabor Grothendieck
Subject: strip month and year from MM/DD/YYYY format
In-Reply-To: <OFB2D613C9.A1B0D0E8-ON862577BB.0051124F-862577BB.00517B37@nps.gov>
On Wed, Oct 13, 2010 at 10:49 AM, <Kurt_Helf at nps.gov> wrote:
> Greetings
> ? ?I'm having difficulty witht the strptime function. ?I can't seem to
> figure a way to strip month (name) and year and create separate columns
> from a column with MM/DD/YYYY formatted dates. ?Can anyone help?
Try month.day.year in chron:
> library(chron)
> dat <- as.Date(c("6/12/2009", "4/15/2010"), "%m/%d/%Y")
> month.day.year(dat)
$month
[1] 6 4
$day
[1] 12 15
$year
[1] 2009 2010
> # or
> as.data.frame(month.day.year(dat))
month day year
1 6 12 2009
2 4 15 2010
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com