lapply_return_array: Lapply with array output

Description Usage Arguments Value Examples

Description

Same as lapply, but output of lapply is converted to array.

Usage

1

Arguments

x

A vector or list; see lapply for details.

dim

Vector with dimensions of the returned array.

FUN

Function to be applied to each element of x; see lapply for details.

...

Any additional arguments to FUN.

Value

As for lapply, but with output converted to array.

Examples

1
2
3
4
5
6
7
matrix_example <- matrix(1:9, ncol = 3)
ShadowCAT:::lapply_return_array(x = 1:3, 
                                dim = c(3, 3, 3), 
                                FUN = function(i, matrix_example) { 
                                        matrix_example[i,] %*% t(matrix_example[i,]) 
                                      }, 
                                matrix_example = matrix_example)

Karel-Kroeze/ShadowCAT documentation built on May 7, 2019, 12:28 p.m.