Re: [R] two different date formats in the same variable

2009-03-23 Thread Gabor Grothendieck
Try this: > library(chron) > x <- c("06/25/04", "06/25/2004", "03/03/59", "03/03/1959") > chron(x) [1] 06/25/04 06/25/04 03/03/59 03/03/59 On Mon, Mar 23, 2009 at 8:06 PM, Farrel Buchinsky wrote: > How does one convert to a date format when survey respondents have > used two different date form

Re: [R] two different date formats in the same variable

2009-03-23 Thread jim holtman
Try using 'strsplit' to split your string on the '/' and then create a series of 'if's to determine how you want to output the new string. You will probably need this approach since you may have to check the validity and ranges of the numbers. On Mon, Mar 23, 2009 at 8:06 PM, Farrel Buchinsky wro

[R] two different date formats in the same variable

2009-03-23 Thread Farrel Buchinsky
How does one convert to a date format when survey respondents have used two different date formats whilst entering their data. There were clearly told to use mm/dd/ but humans being humans some entered mm/dd/yy. There was even validity checks on the forms but I allowed them to be overridden sin