[R] ts or xts with high-frequency data within a year

Giorgio Garziano giorgio.garziano at ericsson.com
Thu Mar 31 14:59:35 CEST 2016


>From "decompose()" source code, two conditions can trigger the error message:

   "time series has no or less than 2 periods"

based on the frequency value, specifically:

  1. f <= 1
  2. length(na.omit(x)) < 2 * f

It appears to me that your reproducible code has got a typo error, it should be:


I mean X[,3] in place of X[,2].

Further, frequency=24*365, 2*frequency > 6000 = length(X[,3]), and that triggers the second condition.

>From R console:

> decompose
function (x, type = c("additive", "multiplicative"), filter = NULL)
    type <- match.arg(type)
    l <- length(x)
    f <- frequency(x)
    if (f <= 1 || length(na.omit(x)) < 2 * f)
        stop("time series has no or less than 2 periods")




	[[alternative HTML version deleted]]

More information about the R-help mailing list