ism | R Documentation |
ism()
applies the Index Sequential Method to a single trace of data to
create multiple traces. ism()
will work on matrices, xts, nfd,
crss_nf, and crssi objects. ism_get_site_matrix()
is a deprecated
precursor to this function that only works on xts
objects.
ism(x, n_years_keep = NA, ...)
## S3 method for class 'crssi'
ism(x, n_years_keep = NA, ...)
## S3 method for class 'crss_nf'
ism(x, n_years_keep = NA, ...)
## S3 method for class 'nfd'
ism(x, n_years_keep = NA, ...)
## S3 method for class 'xts'
ism(x, n_years_keep = NA, ...)
## S3 method for class 'matrix'
ism(x, n_years_keep = NA, is_monthly, ...)
ism_get_site_matrix(xtsData, startMonth, nYrs = NA, monthly = TRUE)
x |
An R object. |
n_years_keep |
The number of years of data to keep. This must be <= the
number of years of data that exists in |
... |
Further arguments passed to subsequent methods. |
is_monthly |
Boolean. |
xtsData |
An xts vector. |
startMonth |
The start month and year of the return matrix. Should be able to be cast to a zoo::yearmon. |
nYrs |
The number of years to create the data for. Defaults to the number of years in xtsData, but can be less. |
monthly |
Boolean that should be set to |
ism()
will determine if the data are annual or monthly (or contain both for
objects inheriting from nfd
), and will act accordingly. The time step can
be forced by using is_monthly
, but that is only necessary for matrices.
If is_monthly
is used with an nfd
type object that contains annual and
monthly data, an error will occur.
ism_get_site_matrix()
is a deprecated version of ism()
that only works
on xts
objects. It takes in 1 column of historical data for a single
site and applies (ISM) to it. This function allows you to change the start
date of the returned data in it, while ism()
does not. When using ism(), [reindex()] should be used after it to change the start date.
ism_get_site_matrix()can be used on monthly or annual data. If applying it to monthly data, then
xtsDataneeds to be monthly data, and
monthlyshould be set to
TRUE. If using annual data, then
xtsDatashould be annual, i.e., all with a December time stamp, and
monthlyshould be set to
FALSE. If
monthlyis
FALSEand
xtsData' is
monthly data, an error will occur.
ism()
returns an object of the same class as x
, but with more
traces, and potentially trimmed to the number of years specified by
n_years_keep
.
ism_get_site_matrix()
returns an xts
matrix with the number of
years/months specified by nYrs
and the number of columns equal to the
number of years in xtsData
# monthly data, that will create a 48x4 xts matrix
t1 <- xts::xts(1:48, zoo::as.yearmon("Jan 2000") + seq(0,47)/12)
ism(t1)
# annual data that will create a 5 x 6 matrix
t2 <- xts::xts(1:6, zoo::as.yearmon("Dec 2000") + 0:5)
ism(t2, n_years_keep = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.