Description Usage Arguments Value Note Author(s) Examples
Given an array data with 4 dimensions,
a subset around the element with coordinates mp ("missing position") is extracted.
The size of the subset in all four directions
from mp is specified by size.
ArrayAroundRandom returns a subset around a
random location in data.
1 2 3 4 5 6 7 8 | ArrayAround(data, mp, size)
ArrayAroundRandom(
data,
size = c(0L, 0L, 0L, 0L),
target = c("all", "missing", "observed"),
verbose = TRUE
)
|
data |
Array with 4 dimensions. |
mp |
Integer vector of length 4
indexing an element in |
size |
Integer vector of length 4, that provides
the size of the subset in all four dimensions
(around |
target |
One of
|
verbose |
Logical vector of length 1.
If |
Array with 4 dimensions corresponding to the specified subset.
The attribute mp of the returned array is an integer vector
of length 4 giving mp relative to the
returned array.
When size = c(0, 0, 0, 0), the returned subset consists of one value
(the value of data indexed with mp.)
When mp is near the boundaries of data,
the returned subset may be smaller than indicated by the argument size
and the attribute mp may indicate an element near the boundaries of the subset.
Florian Gerber, flora.fauna.gerber@gmail.com.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | a <- array(1:16, c(2, 2, 2, 2))
ArrayAround(data = a, mp = c(1, 1, 1, 1), size = c(0, 0, 0, 0))
## returns the first element a[1,1,1,1]
ArrayAround(data = a, mp = c(2, 2, 2, 2), size = c(0, 0, 0, 0))
## returns the last element a[2,2,2,2]
ArrayAround(data = a, mp = c(1, 1, 1, 1), size = c(1, 0, 0, 0))
## returns a[1:2,1,1,1]
ArrayAround(data = a, mp = c(1, 1, 1, 1), size = c(1, 1, 1, 1))
## returns a
ArrayAroundRandom(a)
ArrayAroundRandom(a, size = c(1, 2, 1, 2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.