Learn R Programming

annotationTools (version 1.46.0)

compactList: Concatenate list elements

Description

Concatenates given elements of a list.

Usage

compactList(lst,l)

Arguments

lst
list object
l
numeric vector specifying the number of list elements to be concatenated sequentially

Value

clst
list of length 'length(l)' where the 'i'-th element has length 'l[i]' and contains concatenated elements of input list 'lst'.

Details

By definition, the output list is shorter than the input list.

Function stops if 'sum(l)' does not equal 'lenght(lst)'.

Examples

Run this code
##an example list
lst<-vector('list',3)
lst[[1]]<-c('aaa','bbb')
lst[[2]]<-'ccc'
lst[[3]]<-'zzz'
##merge first 2 list elements
compactList(lst,c(2,1))

Run the code above in your browser using DataLab