strip month and year from MM/DD/YYYY format
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