[R] xts/time-series and plot questions...

Douglas Philips dgou at mac.com
Tue Oct 4 07:38:01 CEST 2011


On 2011 Oct 3, at 4:55 PM, Joshua Ulrich wrote:
> ts requires a time-based index, so there's no way to make an index
> "year-free".  What you can do, is split the xts object into years,
> convert all the index values to have the same year, and merge them
> together.

Ah... of course. I had read the vignette for xts, but didn't notice the
indexing capabilities. Thank you.

> ded below converts the index values to
> a specific year.  A "month-free" solution would be similar.  I'd also
> recommend using plot.zoo for more complex graphs.

Great! I was able to plot the comparative data quite easily with that code.

You mentioned "month-free" solution being similar, but I am not sure about that part.
Specifically, one thing I want to do is compare data by month, but I also want to see
that comparison preserve the day of the week. For example, 2011/10/01 is a Saturday, but
2010/10/01 is a Friday. When I see both on the same plot, I want to see them lined up
by days of week, rather than have the first day for each at the same place on the graph.
(I'm not sure I'm communicating this well, I hope this is making sense).

Thank you again!
   --Doug



More information about the R-help mailing list