list2array: Function to convert a list of dataframes to a 3D array All...

Description Usage Arguments Value Examples

View source: R/helpers.R

Description

Function to convert a list of dataframes to a 3D array All objects in the list will be dataframes with identical column headings. From Hannah Buckley (https://www.researchgate.net/publication/277670582_R_function_to_convert_a_list_of_dataframes_into_a_3-D_array)

Usage

1
list2array(input.list)

Arguments

input.list

List of dataframes

Value

three dimensional array (rows) x (cols) x (dataframenumber in list)

Examples

1
2
3
4
5
dat.ls <- vector("list",10) # empty list
for(i in 1:10) {
dat.ls[[i]] <- data.frame(xx=rnorm(25,3,2),yy=rnorm(25,2,1),zz=rnorm(25,2,1))
}  # fill list
dat.ary <- list2array(dat.ls)  # convert to ary

Famondir/birtms documentation built on Feb. 18, 2022, 2:51 a.m.