[.sk {snapKrig} | R Documentation |
Extract a sk list element (single-bracket access)
Description
Copies the specified list element or grid point value
Usage
## S3 method for class 'sk'
x[i = NULL, j = NULL, drop = FALSE, ...]
Arguments
x |
a sk object |
i |
column-vectorized index |
j |
index of layer (only for multi-layer x) |
drop |
ignored |
... |
ignored |
Details
Behavior depends on the class of i. For character vectors this extracts the named list entries of x. For numeric, it accesses the vectorized grid data values. For multi-layer objects, a layer can be specified in j.
the default NULL
for i
and j
is treated as numeric, and is shorthand for all
indices. For example if x
has a single-layer x[]
returns all grid data in a vector.
If x
is multi-layer x[,1]
all grid data from the first layer, and x[]
returns all
layers, as a matrix.
Value
a list, vector, or matrix (see description)
Examples
# define a sk list and extract two of its elements
g = sk_validate(list(gval=stats::rnorm(4^2), gdim=4, gres=0.5))
g[c('gdim', 'gres')]
# display all the grid data as a vector or a matrix
g[]
matrix(g[], dim(g))
# extract a particular grid point or a subset
g[1]
g[seq(5)]
[Package snapKrig version 0.0.2 Index]