update_array: Update an array with a sub-array.

Description Usage Arguments Details Value

View source: R/update_array.R

Description

This function will update an array with a sub-array, without any need for the user to worry about the dimension-names.

Usage

1
update_array(.arr, .sub_arr, .env = parent.frame())

Arguments

.arr

The array we want to update. 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.

.sub_arr

Tue sub-array we want to insert into .arr. The dimension-names of .sub_arr must be contained in those of .arr, but they do not need to be given in the same order.

.env

An environment in which .arr will be updated. The default value is the environment of the calling function.

Details

Arrays are awesome, but it can alas be agonising to keep track of the dimension-names. This function frees the user from such frustrations.

Value

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.


LAJordanger/leanRcoding documentation built on Feb. 27, 2020, 4:42 p.m.