[R] getting dates from a ts object
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Aug 12 18:59:39 CEST 2009
time(obj) gives the times of a ts object, obj.
On Wed, Aug 12, 2009 at 12:51 PM, Data Analytics
Corp.<dataanalytics at earthlink.net> wrote:
> Hi,
>
> I have a ts object called data.gas that has three economic variables:
> gasoline consumption (gas), price per gallon (price), and household income
> (income) by month from January 1970 to December 2008. I want to plot this
> gas and price variables using ggplot2, but ggplot2 will not allow an object
> of class mts or ts; it has to be a data frame. When I use
> as.data.frame(data.gas), the date information is lost. How can I capture
> the date information in a vector so I can add it to a data frame created
> using as.data.frame?
>
> Thanks,
>
> Walt
>
>
>
> --
> ________________________
>
> Walter R. Paczkowski, Ph.D.
> Data Analytics Corp.
> 44 Hamilton Lane
> Plainsboro, NJ 08536
> ________________________
> (V) 609-936-8999
> (F) 609-936-3733
> dataanalytics at earthlink.net
> www.dataanalyticscorp.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.
>
More information about the R-help
mailing list