[R] Extract dates from dataframe

bartjoosen bartjoosen at hotmail.com
Fri Mar 6 12:17:01 CET 2009


Hi,

I have the following dataframe:
   ID                            Dates
  1               16-07-01  06-10-95
  2            24/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
1    16-07-01
1    06-10-95
2    24-01-02
2  ....

I have no clue about how to get started, looks something for the
regexp/grep/... kind of functions, but I don't get the point.

Any thoughts??

Kind regards

Bart Joosen

PS: for the reconstruction of the dataframe:
dat <-
structure(list(ID = c(1, 2, 3), Dates = structure(c(2L, 4L, 6L
), .Label = c("16-01-02   16-08-94", "16-07-01  06-10-95", "24-01-02    
06-10-95", 
"24/01/02     06-10-95", "16/01/02   16/08/94", "16/01/02   16/08/94    
12/01/91"
), class = "factor")), .Names = c("ID", "Dates"), row.names = c(NA, 
3L), class = "data.frame")


-- 
View this message in context: http://www.nabble.com/Extract-dates-from-dataframe-tp22369479p22369479.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list