Re: [R] String manipulation with regexpr, got to be a better way

2011-09-30 Thread Eik Vettorazzi
Hi Chris, why not using routines for dates dates <- c("09/10/2003", "10/22/2005") format(strptime(dates,format="%m/%d/%Y"),"%Y") or take just the last 4 chars from dates gsub(".*([0-9]{4})$","\\1",dates) cheers Am 29.09.2011 16:23, schrieb Chris Conner: > Help-Rs, > > I'm doing some string man

Re: [R] String manipulation with regexpr, got to be a better way

2011-09-29 Thread Jean V Adams
Chris Conner wrote on 09/29/2011 09:23:02 AM: > > Help-Rs, > > I'm doing some string manipulation in a file where I converted a > string date in mm/dd/ format and returned the date . > > I've used regexpr (hat tip to Gabor G for a very nice earlier post > on this function) in steps (

[R] String manipulation with regexpr, got to be a better way

2011-09-29 Thread Chris Conner
Help-Rs,   I'm doing some string manipulation in a file where I converted a string date in mm/dd/ format and returned the date .   I've used regexpr (hat tip to Gabor G for a very nice earlier post on this function) in steps (I've un-nested the code and provided it and an example of what