[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 <bolker at ufl.edu>
> Date: Saturday, February 13, 2010 1:03 pm
> Subject: Re: [R] (no subject)
> To: r-help at 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 at 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
bolker at ufl.edu / people.biology.ufl.edu/bolker
GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL:
<https://stat.ethz.ch/pipermail/r-help/attachments/20100213/7da57197/attachment.bin>