[R] Convert number to Date

Rolf Turner r.turner at auckland.ac.nz
Fri Mar 26 00:28:27 CET 2010


On 26/03/2010, at 12:23 PM, Achim Zeileis wrote:

> Sorry for coming so late to this thread. One possible explanation for the 
> R side is the following...
> 
> 
> On Thu, 25 Mar 2010, Marc Schwartz wrote:
> 
>> On Mar 25, 2010, at 5:41 PM, Joshua Wiley wrote:
>> 
>>>> Kind of off the thread a bit, but when I do:
>>>> 
>>>>> as.Date(40182)
>>>> 
>>>> I ***do not*** get "2080-01-06".  Instead I get an error:
>>>> 
>>>> Error in as.Date.numeric(40182) : 'origin' must be supplied
> 
> Yes, that is when you use base R's as.Date.numeric() but package "zoo" 
> overloads that:
> 
> R> as.Date(40182)
> Error in as.Date.numeric(40182) : 'origin' must be supplied
> R> library("zoo")
> R> as.Date(40182)
> [1] "2080-01-06"


Ah-ha!!!  So Anna must have had zoo loaded when she did her as.Date() command.

All is in harmony.  OMMMMMMMMMMMMMMMMMM!!!

Thanks for that.

	cheers,

		Rolf
######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################



More information about the R-help mailing list