aggregate.ts (PR#376)

About this list Date view Thread view Subject view Author view Other groups

Subject: aggregate.ts (PR#376)
plummer@iarc.fr
Date: Thu 16 Dec 1999 - 23:15:51 EST


Message-Id: <199912161315.OAA18954@pubhealth.ku.dk>

I'm having some problems with aggregate.ts, e.g.

R> x <- ts(1:20)
R> frequency(x)
[1] 1

R> aggregate(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--

Version:
 platform = i686-unknown-linux
 arch = i686
 os = linux
 system = i686, linux
 status =
 major = 0
 minor = 90.1
 year = 1999
 month = December
 day = 15
 language = R

Search Path:
 .GlobalEnv, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:11 EST