Re: [Rd] na.omit error message

From: Gabor Grothendieck <ggrothendieck_at_myway.com>
Date: Sat 26 Mar 2005 - 16:28:19 GMT

Gabor Grothendieck <ggrothendieck <at> myway.com> writes:

:
: If I create a bivariate ts series with 3 time points and run
: na.omit on it expecting it to reduce it to a one point ts series
: instead I get the following error messasge:
:
: R> hh <- ts(matrix(c(NA,1:4,NA),3), start = c(1951,8), freq=12)
: R> hh
: Series 1 Series 2
: Aug 1951 NA 3
: Sep 1951 1 4
: Oct 1951 2 NA
: R> na.omit(hh)
: Error in "tsp<-"(`*tmp*`, value = c(1951.66666666667, 1951.66666666667, :
: invalid time series parameters specified
:
: If I replace na.omit with na.contiguous then I get a protection stack
: overflow:
:
: R> na.contiguous(hh)
: Error: protect(): protection stack overflow
:
: R> R.version.string # Windows XP
: [1] "R version 2.1.0, 2005-03-23"
:
: Any comments on what is wrong?
:

I am not sure if this is related to the last problem or not but its a problem at any rate. This is from R 2.1.0 March 23, 2005 on Windows XP.

  1. stats:::.cbind.ts

In stats:::.cbind.ts the line which is commented below (which is currently in the existing R code) should be replaced by the line following it which I have added to take into account floating point approximations:

    if (union) {

        st <- min(tsps[1, ])
        en <- max(tsps[2, ])

    }
    else {
        st <- max(tsps[1, ])
        en <- min(tsps[2, ])
        # if (st > en) {
	if (st > en + getOption("ts.eps")) {  # replaces commented line
            warning("non-intersecting series")
            return(NULL)
        }

    }

2. stats:::window.default


Also, for the same reason, in stats:::window.default, the line which I have commented should be changed to the following line that is not commented:

    # if (start > end)
    if (start > end + ts.eps) # replaces commented line

        stop("'start' cannot be after 'end'")

also to take into account floating point approximations.



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun Mar 27 02:32:39 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:26:32 GMT