powered by
compactList(lst,l)
Function stops if 'sum(l)' does not equal 'lenght(lst)'.
##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