Displaying 1 result from an estimated 1 matches for "flattenlist".
2011 May 19
0
Flattening lists and environments (was: "how to flatten a list to the same level?")
...onListElements(x[[i]], env) # call
> recursively
> } else {
> res<- get("res", envir = env) # get res from other env
> res<- c(res, list(x)) # add one list element
> assign("res", res, envir=env) # assign back to env
> }
>
> }
>
> flattenList <- function(l){
>
> res<- list() # make list object
> env<- environment() # get current env
> .getNonListElements(l, env) # search for non list elements recursively
> return(res)
>
> }
>
> l <- list(DF=data.frame(A=c(1,2)), vec=c("a&quo...