R/nestedList2List.R

Defines functions nestedList2List

Documented in nestedList2List

## File Name: nestedList2List.R
## File Version: 0.05

###############################################
# converts a nested list into a list
nestedList2List <- function(nestedList)
{
    NB <- length(nestedList)
    # count number of elements
    M <- 0
    for (bb in 1:NB){
        M <- M + length(nestedList[[bb]])
    }
    # create new list object
    list1 <- as.list(1:M)
    vv <- 1
    for (bb in 1:NB){
        NW <- length(nestedList[[bb]])
        for (ww in 1:NW){
            list1[[vv]] <- nestedList[[bb]][[ww]]
            vv <- vv + 1
        }
    }
    return(list1)
}
#################################################

Try the miceadds package in your browser

Any scripts or data that you put into this service are public.

miceadds documentation built on May 29, 2024, 11:05 a.m.