flatten_array: Drop the 3rd dimension of an array using a summary function,...

View source: R/flatten_array.R

flatten_arrayR Documentation

Drop the 3rd dimension of an array using a summary function, e.g., min max, mean

Description

This function takes in a 3D array of values, effects or t_stats, etc. and returns a 2D matrix in which each entry contains a single value representing all corresponding entries in the 3rd dimension. This number is determined by the function specified by the user. It could be min, max, mean, etc.

Usage

flatten_array(arrayX, margin1, margin2, slice_fun)

Arguments

arrayX

3D array of values, effects or t_stats, etc.

margin1

dimension that will end up as the columns of the final matrix

margin2

dimension that will end up as the rows of the final matrix

slice_fun

summary function. The function by which to summarize the remaining dimension e.g., function(x) mean(x, na.rm = TRUE)

Value

A 2D matrix summarizing the input array


cape documentation built on May 29, 2024, 5:11 a.m.