search for: getnonlistel

Displaying 1 result from an estimated 1 matches for "getnonlistel".

2011 May 19
0
Flattening lists and environments (was: "how to flatten a list to the same level?")
...the code!! It works out fine for vectors. I forgot to > mention I also have dataframes as list elements. Thus I want the > structure of the list element to be kept intact. > > I tried an recursive approach (which unfortunately resulted in some > more code) which works. > > .getNonListElements <- function(x, env){ > > if(class(x)=="list") { > for(i in seq(along=x)) .getNonListElements(x[[i]], env) # call > recursively > } else { > res<- get("res", envir = env) # get res from other env > res<- c(res, list(x)) # add one li...