seas.check {seas} | R Documentation |
Check the suitability of a data.frame
or
seas.sum
object for seas.
seas.df.check(x, orig, var) seas.sum.check(x, orig, var, norm, year.filter, ann.only)
x |
a data frame with temporal observations |
orig |
the original name of the data frame, for error messages |
var |
one or more variables in x , which are tested;
ignored if NULL or missing |
norm |
something to normalize var ; it can either be the
name of an array in x , a matrix (bin vs
years ), or a 3-dim array (used to normalize
multiple var ); this is tested to see if norm exists,
and that the dimension are consistent with x |
year.filter |
a subset of x$years , which filters all the
related arrays in the returned value |
ann.only |
x$seas arrays are ignored |
This utility function simply checks the suitability of a
data.frame
or seas.sum
objects for use with
seas.
If x
is data.frame
(using seas.df.check
that is
really required, is a ‘date’ column, named x$date
with a
class of either link{POSIXct}
or link{Date}
, and
one or more variables in the var
columns of x
.
There must be at least one finite observation in each of var
,
if supplied.
These function is used within other functions, and is not intended to be called directly.
seas.df.check
returns a few helpful items from x
in a
list
using invisible
:
id
:attr(x,"id")
or
x$id[1]
name
:year.range
:calendar
:x$date
;
otherwise this will be NULL
for a normal proleptic
Gregorian calendarmain
:.seastitle
units
:var[1]
long.name
:var[1]
ylab
:var[1]
seas.sum.check
returns x
with modifications, depending
on norm
and year.filter
.
M.W. Toews
hidden
functions for seas
data(mscdata) dat <- mksub(mscdata, id=1108447) str(seas.df.check(dat)) dat.ss <- seas.sum(dat) str(seas.sum.check(dat.ss,norm="days"))