[cc'ing back to r-help] You need to get the separator right: you specify slashes below where your date is space-separated
as.Date("02 03 2008", format="%m %d %Y") note that the solution I gave you below assumed that your dates were in d/m/Y order (since you didn't specify). You will have to modify things slightly (i.e. specifying format explicitly) if that's not true. Hussain Abusaaq wrote: > I hope that will work. just to make my problem clear > when i used as.date for e "02 03 2008" it gives me NA > > for example > >> as.Date("02 03 2008",format="%m/%d/%Y") > [1] NA > I hope you can help me here > ----- Original Message ----- > From: Ben Bolker <bol...@ufl.edu> > Date: Saturday, February 13, 2010 1:03 pm > Subject: Re: [R] (no subject) > To: r-h...@stat.math.ethz.ch > >> Hussain Abusaaq <hia05 <at> fsu.edu> writes: >> >>> I have this vector and I want to change it to date. >>> >>> for example G=[05 12 2008] >>> >>> or g=[2] >>> f=[3] >>> y=[2208] >>> >> Something like as.Date(paste(rev(G),collapse="-")) >> >> ______________________________________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting- >> guide.htmland provide commented, minimal, self-contained, >> reproducible code. >> -- Ben Bolker Associate professor, Biology Dep't, Univ. of Florida bol...@ufl.edu / people.biology.ufl.edu/bolker GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
signature.asc
Description: OpenPGP digital signature
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.