tsp is supposed to be applied to a ts object. If you are not using ts
objects then that is your problem.
On Fri, Nov 20, 2009 at 6:43 PM, Samik Raychaudhuri wrote:
> Looks like there is a difference between when I use frequency(x) vs. when I
> use frequency(x.ts). If I try to get the tsp attribut
Looks like there is a difference between when I use frequency(x) vs.
when I use frequency(x.ts). If I try to get the tsp attribute of x by
using attr(x, "tsp"), it still shows up as NULL. When I looked at the
code of frequency() function (in stats), it seems to be looking at
attr(x, "tsp"), whi
Not for me.
> x <- 1:100
> x.ts <- ts(x, start = 1, frequency = 4)
> frequency(x.ts)
[1] 4
On Fri, Nov 20, 2009 at 6:21 PM, Samik Raychaudhuri wrote:
> Thanks Gabor. Even after doing as you suggested, when I check the frequency
> of x, it still shows up as 1. I would have expected it to be 4 no
Thanks Gabor. Even after doing as you suggested, when I check the
frequency of x, it still shows up as 1. I would have expected it to be 4
now.
> x.ts <- ts(x, start=1, frequency=4)
> frequency(x)
[1] 1
On 11/20/2009 4:05 PM, Gabor Grothendieck wrote:
The first two components of the tsp vector
The first two components of the tsp vector are in time units as
mentioned in ?tsp . Thus you would want:
> x <- 1:100
> tsp(x) <- c(1, 25.75, 4)
but normally you don't have to set it explicitly in the first place.
Just use ts:
> x <- 1:100
> x.ts <- ts(x, start = 1, frequency = 4)
> tsp(x.ts)
[1
Hello,
I am wondering how I should set up the tsp attribute (available through
attr(x, "tsp")) of a dataset x? Let's assume that x has 100 points, and
I want to set the frequency to 4.
I tried:
> attr(x,"tsp")<-c(1,100,4)
Error in attr(x, "tsp") <- c(1, 100, 4) :
invalid time series parameters
6 matches
Mail list logo