subsetByNamesOrIndices: Extract multiple elements from a list

Description Usage Arguments Details Value Examples

View source: R/myBasicFunctions.R

Description

Extract multiple elements from a list

Usage

1
subsetByNamesOrIndices(bigList, templNames)

Arguments

bigList

a list from where elements will be extracted

templNames

a vector containing indices or names of the element to extract

Details

The name of the output list will match the name of the bigList even if the indices were used.

Value

A list containing only the elements named in templNames or whose indices are in templNames from bigList

Examples

1
2
3
l<-list('a'=c(1,3),'b'=letters[1:10],'c'="fun")
subsetByNamesOrIndices(l,1:2)
subsetByNamesOrIndices(l,c("a", "c"))

lldelisle/usefulLDfunctions documentation built on Nov. 29, 2021, 5:40 a.m.