Displaying 5 results from an estimated 5 matches for "nfrequenc".
Did you mean:
nfrequency
1999 Dec 16
1
aggregate.ts (PR#376)
...ggregate(x, nfreq=1/3)
Error in aggregate.ts(x, nfreq = 1/3) : cannot change frequency from 1 to
0.333333333333333
In fact aggregate.ts only accepts a new frequency that is a negative
power of two in this example.
The problem with the current test for compatible frequencies
if ((ofrequency%%nfrequency) != 0)
stop(paste("cannot change frequency from", ofrequency,
"to", nfrequency))
is that numerical errors may cause it to fail. I suggest
if (abs(ofrequency%%nfrequency) < ts.eps)
instead.
Martyn
--please do not edit the information below--
Ver...
2005 Jan 31
2
changing the time base in a ts
..., I want the points for the seasonal plot to line up
with cycle 6 of the first plot.
Thanks.
dat <- ts(rnorm(12*20), start = c(1980,1), frequency = 12)
plot(dat)
dat.sub <- dat
dat.sub[cycle(dat.sub) < 6] <- NA
dat.sub[cycle(dat.sub) > 8] <- NA
dat.sub <- aggregate(dat.sub, nfrequency = 1, FUN = mean, na.rm = T)
tsp(dat)
tsp(dat.sub)
par(mfrow = c(2, 1))
plot(dat)
plot(dat.sub, type = "b")
2009 Aug 18
1
aggregating values at discreet irregular time intervals into hourly values
...can't get the codes right to do what I want. Here are examples of unsuccessful attempts:
try = aggregate(test.irts$value, by= list(time=test.ts$time), FUN= mean)
ERROR MESS: Error in FUN(X[[1L]], ...) : arguments must have same length
try = aggregate.ts(test.irts$value,frequency(test.ts$time),nfrequency=1, ndeltat=1)
PROBLEM: gives me only one vector for my values (no time vector) but they are NOT aggregated by hour.
try = list(x=test.ts$time, y=aggregate.ts(test.irts$value, nfrequency=1))
PROBLEM: Gives 2 separate vectors :hourly time step and values - but again, values are not aggregated by ho...
2008 Jan 06
1
aggregate.ts help
...1
1987 12 13 14 15
1988 16 17 18 19
1989 20
If I do this manually, the mean for the 1st quarter would be
mean(c(4,8,12,16,20)), which is 12. But I am wondering if there is a R
function that could do this faster. I tried aggregate.ts but it didn't work:
> aggregate(ts.data,nfrequency=4,mean)
Qtr1 Qtr2 Qtr3 Qtr4
1984 1 2 3
1985 4 5 6 7
1986 8 9 10 11
1987 12 13 14 15
1988 16 17 18 19
1989 20
Does anyone know what am I doing wrong?
--
Tom
[[alternative HTML version deleted]]
2000 Apr 11
0
aggregate.ts (PR#514)
...uency = 0.5
[1] 2 4 6 8
S> x <- rts(1:10)
S> aggregate(x, nf=0.5, fun = min)
[1] 1 3 5 7 9
start deltat frequency
1 2 0.5
I have edited the aggregate.ts function to reproduce the S-PLUS
behaviour, which I find more intuitive:
old:
#nstart <- ceiling(tsp(x)[1] * nfrequency)/nfrequency
#x <- as.matrix(window(x, start = nstart))
new:
nstart <- tsp(x)[1]
# Can't use nstart <- start(x) as this causes problems if
# you get a vector of length 2.
x <- as.matrix(x)
I have tried this on a range of examples and have not encountered
any...