appends: Append multiple list items

View source: R/appends.r

appendsR Documentation

Append multiple list items

Description

Recursively iterate through each of the list items to make one simplified list. Flattens all lists without a name, while preserving lists with a name. Also keeps the names of all provided names and ignores non-existent list objects.

Usage

appends(...)

Arguments

...

Feed values of any type to have it return a single list

Value

A single list of all of the lists flattened in a certain manner

See Also

base::append(), base::unlist()

Examples

a <- "x"
x <- matrix(c(c(1,2),c(3,4)), ncol = 2)
testList <- list(test = "abc", test2 = 12, test3 = list(testA = "xyz", testB = 2), test5 = x, test6 = a)
testList2 <- list(test7 = "xt", test8 = "yes")
testList3 <- list(test9 = x)
t <- appends(testList, testx = testList2, testList3, testList$xyz)

## List of 7
## _names: chr [1:7] "test" "test2" "test3" "test5" "test6" "testx" "test9"
## test:"abc"
## test2:12
## test3:List of 2
## test5: num [1:2, 1:2] 1 2 3 4
## test6:"x"
## testx:List of 2
## test9: num [1:2, 1:2] 1 2 3 4

joshuaderekwhite/buildmodels documentation built on April 27, 2022, 3:35 a.m.