[R] date format

Gabor Grothendieck ggrothendieck at gmail.com
Thu Aug 11 02:36:28 CEST 2005


Small point but since:

- the paste function will convert its arguments to character
- as.Date will give you the format requested anyways 
- minus is the logical separator here

we could modify that to:

	as.Date(paste(d, 15, sep = "-"))



On 8/10/05, bogdan romocea <br44114 at gmail.com> wrote:
> You need the day to convert to a date format. Assuming day=15:
> x.date <- as.Date(paste(as.character(x),"-15",sep=""),format="%Y-%m-%d")
> 
> 
> > -----Original Message-----
> > From: alessandro carletti [mailto:alxmilton at yahoo.it]
> > Sent: Wednesday, August 10, 2005 9:37 AM
> > To: rHELP
> > Subject: [R] date format
> >
> >
> > Hi,
> > I have a problem with a vector (x) containing dates in
> > format "yyyy-mm" (I'm working with monthly means): how
> > can I convert it in date format, so that I can plot it
> > recognising trends for my variables?
> > class(x) says: factor
> > Thanks
> > Alex
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list