[R] Help with dates and characters

Thomas Jensen thomas.jensen at eup.gess.ethz.ch
Tue Jun 29 15:36:55 CEST 2010


Dear R Experts,

I have a vector of dates in character format like this:

date
"2000-01-01"
"2000-01-23"
"2001-03-12"
...
...
...
"2009-12-31"

I would like to delete the last part of the character string (i.e. the  
"day" part), so the vector looks like this:

date
"2000-01"
"2000-01"
"2001-03"
...
...
...
"2009-03"

I have been looking into regular expressions, but i find this very  
confusing.

Thank you for your help,
Thomas



More information about the R-help mailing list