Skip to content

plot a single frequency of a ts object

3 messages · Stefano Sofia, Jim Lemon, William Dunlap

#
On 11/07/2013 04:56 AM, Stefano Sofia wrote:
Hi Stefano,
This may do what you want:

x1<-runif(64,1,4)
x2<-runif(64,2,5)
y1 <- ts(x1, frequency=4, start=c(1952,1))
y2 <- ts(x2, frequency=4, start=c(1952,1))
plot(y1,ylim=c(1,5))
y2w<-ts(y2[seq(1,61,by=4)],frequency=1,start=1952)
lines(y2w)

Jim
#
I think it is simpler to compute y2w using the window() function, which
figures out the right call to seq() for you:
    window(y2, frequency=1, start=c(1952,1)) # use c(1952,2) for springs, etc.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com