If the vector elements are (still) strings, you could simply try
x<- c("2000-01-01", "2000-01-23", "2001-03-12", "2009-12-31")
substring(x, 1, 7)
# [1] "2000-01" "2000-01" "2001-03" "2009-12"
Hope this helps a little.
Allan
On 29/06/10 14:36, Thomas Jensen wrote:
Dear R Experts,
I have a
On Jun 29, 2010, at 8:36 AM, Thomas Jensen wrote:
> 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"
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"
3 matches
Mail list logo