Description Usage Arguments Details Value
View source: R/restrict_array.R
This function will restrict an array based upon a specified subset
of its dimension-names, without any need for the user to worry
about how these dimension-names are positioned within the array.
However, if the user desires that the resulting array should have
the specified order on the dimension-names, then the argument
.permute
can be set to TRUE
in order to achieve that
result.
1 2 | restrict_array(.arr, .restrict, .drop = FALSE, .never_drop = NULL,
.keep_attributes = TRUE, .permute = FALSE)
|
.arr |
The array we want to restrict. The code in its present incarnation requires an array with a full set of unique dimension-names, although I suppose it could be possible to extend to a case where the dimension-names are missing too. |
.restrict |
A named |
.drop |
A logical argument, default value |
.never_drop |
A character vector to be used if |
.keep_attributes |
A logical argument, default value
|
.permute |
A logical argument, default value |
Arrays are awesome, but it can alas be agonising to keep track of the dimension-names. This function frees the user from such frustrations.
The result will depend on how .sub_arr
and
.arr
is related. If the dimension-names of .sub_arr
is contained in those of .arr
, but its dimension is in fact
smaller, then the result will be that .arr
will be filled
with copies of .sub_arr
along the unspecified dimensions. If
the dimensions are equal, then only those components in .arr
that directly match the dimension-names of .sub_arr
will be
affected.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.