On Thu, Feb 24, 2011 at 3:13 PM, Gabriel Bergin <gabr...@bergin.se> wrote:
> Hi,
>
> I have two time series; one of annual data and one of monthly data. How do I
> plot these on the same plot? I checked out ts.plot(), but it only allows for
> different starting times, not different frequencies.
>

Try this assuming ser1 and ser2 are your two ts series:

plot(ser1)
lines(ser2, col = 2)

Another way is:

library(zoo)
z <- na.approx(cbind(as.zoo(ser1), as.zoo(ser2)))
time(z) <- as.yearmon(time(z))
plot(z, screen = 1, col = 1:2)

Omit screen = 1 to get separate panels.


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
R-help@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.

Reply via email to