R/helper_functions.R
array_sum.Rd
Sums over the specified dimensions of an n-dimensional array and reshapes the result back into an array with the correct dimensions.
array_sum(arr, keep_dims)
An n-dimensional array.
An integer vector specifying the dimensions to keep after the summation.
An array with dimensions corresponding to `keep_dims`, containing the summed values.
arr <- array(1:24, dim = c(2, 3, 4)) result <- array_sum(arr, c(1, 2))