[Rd] possible error checking bug and documentation bug in ts

Charles Geyer charlie at stat.umn.edu
Sat Oct 23 05:59:13 CEST 2010


The documentation for ts says "Only one of ‘frequency’ or ‘deltat’ should
be provided" but why doesn't it enforce this with

    stopifnot(missing(frequency) || missing(deltat))

Wouldn't that work?  Also the documentation does not say what valid
time series parameters are.  To find that out one must know to RTFS
in src/main/attrib.c and find that

    end - start  = (n - 1) / frequency

or

   end - start  = (n - 1)  * deltat

is required to avoid an error, where
n is either length(data) or nrow(data).
Why can the help page for ts say that?

I suppose this is picky, but a newbie just wasted a couple of days
with the mysterious error thrown in badtsp in src/main/attrib.c
when he ran afoul of R's argument matching rules and
unintentionally supplied both frequency and deltat (thinking he
was supplying deltat and ts.eps).  It took me more time that it
should have to figure it out too.
--
Charles Geyer
Professor, School of Statistics
University of Minnesota
charlie at stat.umn.edu



More information about the R-devel mailing list