Skip to content
Prev 165067 / 398503 Next

Parsing unusual date format

You can use regular expressions:
as.Date(sub('(\\d+)m(\\d+)','\\1-\\2-01',dts,perl=TRUE))

but as.Date isn't as inflexible as you think:
as.Date(paste(dts,'m01',sep=''),'%Ym%mm%d')

                                        - Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu
On Thu, 18 Dec 2008, markleeds at verizon.net wrote: