[R] date conversion

Patrick Connolly p_connolly at slingshot.co.nz
Fri Mar 18 20:17:39 CET 2011


On Wed, 16-Mar-2011 at 07:58PM -0700, Joshua Wiley wrote:

|> Hi Erin,
|> 
|> I am not sure what a "seq.Date object" is.  My first thought is that
|> you are talking about the date method for seq(), but there are
|> hundreds of packages I do not know.  In any case, here is what I think
|> you want.
|> 
|> Josh
|> 
|> ## A small example is always nice
|> dat <- ts(1:12, frequency = 12,
|>   start = c(1998, 1), end = c(2010, 12))
|> 
|> ## Achim and Gabor's wonderful package
|> require(zoo)
|> ## now just convert to a date
|> as.Date(dat)

I'm impressed with that approach but can't see how it works.

The object dat is of class "ts".  How does having the zoo package in
the search path influence how as.Date() works?  I didn't notice in the
help file for as.Data anything that mentioned zoo and ts objects.

TIA

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



More information about the R-help mailing list