Skip to content
Prev 165078 / 398513 Next

Parsing unusual date format

Thanks so much everyone, these suggestions solve my problem in a very elegant
way. 

A friend and I also came up with this "brute force" solution:

T <- c("1993m10")
y <- gsub("m.", "", T)
m <- gsub(".*m", "", T)
d <- paste(y,"-0",m,"-","01", sep="")
T <- as.Date(d, format="%Y-%m-%d")

Thought I would post it in any case.

Shruthi