[R-SIG-Finance] issues with zoo masking as.Date function, resulting in issues with as.Date

Gabor Grothendieck ggrothendieck at gmail.com
Fri Oct 14 20:19:46 CEST 2011


On Fri, Oct 14, 2011 at 1:21 PM, Zhang, Ivan
<ivan.zhang at bankofamerica.com> wrote:
> Hi Everyone,
>
> I just upgraded to 2.13, this seems like a very obvious issue however I haven't seen this addressed anywhere, perhaps I am missing something elementary?
>
> library(timeDate)
>> as.Date(timeDate('2011-10-10'))
> [1] "2011-10-10"
>> library(zoo)
>
> Attaching package: 'zoo'
>
> The following object(s) are masked from 'package:base':
>
>    as.Date
>
>> as.Date(timeDate('2011-10-10'))
> Error in as.Date.default(timeDate("2011-10-10")) :
>  do not know how to convert 'timeDate("2011-10-10")' to class "Date"
>>
>

The timeDate package needs to export as.Date.timeDate in its NAMESPACE
file .   As a workaround you can do this:

> as.Date.timeDate <- timeDate:::as.Date.timeDate
> as.Date(timeDate('2011-10-10'))
[1] "2011-10-10"

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-SIG-Finance mailing list