as.sts {hero} | R Documentation |
Convert object to sts
class
Description
Convert a numeric three-dimensional array
or
two-dimensional matrix-like object to an
sts
(spatial time series) object. If x
is
a three-dimensional array, the first two dimensions are
assumed to relate to gridded spatial positions. If
x
has only two dimensions, each row is a time
series for a specific location. Each column is a
realization of a geostatistical process at a specific
time.
Usage
as.sts(x)
sts(x)
as_sts(x)
Arguments
x |
A matrix-like object with 2 dimensions or an array with 3 dimensions. |
Details
This method has been tested with objects of class
matrix
, data.frame
,
array
, and
Matrix-class
. It should be
possible for x
to have a different class as long
as the object has a loaded as.matrix
method, which is used in this function.
Value
An sts
object.
Examples
# 3d array to sts
sts = as.sts(tasmax)
class(sts)
# extract a subset of tasmax to produce an sts
x = matrix(c(tasmax[50:60, 50:60, ]), ncol = 30)
sts = as.sts(x)
class(sts)
sts = as.sts(as.array(x))
class(sts)
sts = as.sts(Matrix::Matrix(x))
class(sts)
sts = as.sts(as.data.frame(x))
class(sts)
[Package hero version 0.6 Index]