Re: [R] Extract dates from dataframe

2009-03-06 Thread Gabor Grothendieck
Try this: library(gsubfn) # convert date strings to dd-mm-yy Dates <- gsub("/", "-", dat$Dates) # regular expressiont to match dates re <- "\\d\\d-\\d\\d-\\d\\d" # extract dates and convert them to Date class # giving a list d each of whose components is a vector of dates d <- strapply(Dates, r

[R] Extract dates from dataframe

2009-03-06 Thread bartjoosen
Hi, I have the following dataframe: IDDates 1 16-07-01 06-10-95 224/01/02 06-10-95 3 16/01/02 16/08/94 12/01/91 And I would like to extract the dates, but couple the ID's to the right dates, eg: ID Dates 116-07-01 1