On Wed, Oct 13, 2010 at 10:49 AM,  <kurt_h...@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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to