[R] date conversion

Joshua Wiley jwiley.psych at gmail.com
Thu Mar 17 03:58:22 CET 2011


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)

On Wed, Mar 16, 2011 at 7:22 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
> Dear R People:
>
> I have a monthly time series which runs from January 1998 to December 2010.
>
> When I use tsp I get the following:
>
>> tsp(ibm$ts)
> [1] 1998.000 2010.917   12.000
>
>
> Is there an easy way to convert this to a seq.Date object, please?
>
> I would like to have something to the effect of
> 1998/01/01 .... 2010/12/01
>
> Thanks,
> Erin
>
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
>
> ______________________________________________
> 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.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list