On Wed, Aug 18, 2010 at 3:33 AM, Mangalani Peter Makananisa
<
[hidden email]> wrote:
> Dear R gurus,
>
>
>
> I am currently using the chron package for date manipulation in R and I
> am able to control the date which take the format
>
>
>
> - 1998/07/03, and
>
> - 2006-09-15 (date without time)
>
>
>
> Library(chron)
>
> As.Date(2006-09-15, format = '%Y-%m-%d')
>
>
>
> However I have a problem with the date containing only the year and
> month (i.e. 2006-09, 2007/08, 200609).
>
>
>
zoo has a yearmon class for representing year and month without a date:
library(chron)
library(zoo)
as.chron(as.yearmon("2006-09"))
as.Date(as.yearmon("2006-09"))
or you may be able to just use the yearmon class directly: as.yearmon("2006-09")
See help(yearmon) in zoo.
______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide
http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.