Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nestedList2List

Converting a Nested List into a List (and Vice Versa)


Description

Converts a nested list into a list (and vice versa).

Usage

nestedList2List(nestedList)

List2nestedList(List, N_between, N_within=NULL, loop_within=TRUE)

Arguments

nestedList

A nested list

List

A list

N_between

Number of between list elements

N_within

Number of within list elements

loop_within

Optional logical indicating whether looping should start from within list

Value

A list or a nested list

Examples

#############################################################################
# EXAMPLE 1: List conversions using a small example
#############################################################################

# define a nestedList
nestedList <- as.list(1:3)
nestedList[[1]] <- as.list( 2:4 )
nestedList[[2]] <- as.list( 34 )
nestedList[[3]] <- as.list( 4:9 )

# convert a nested list into a list
v2 <- miceadds::nestedList2List( nestedList)

## reconvert list v2 into a nested list, looping within first
v3 <- miceadds::List2nestedList(v2, N_between=5)
# looping between first
v4 <- miceadds::List2nestedList(v2, N_between=5, loop_within=FALSE)

miceadds

Some Additional Multiple Imputation Functions, Especially for 'mice'

v3.11-6
GPL (>= 2)
Authors
Alexander Robitzsch [aut,cre] (<https://orcid.org/0000-0002-8226-3132>), Simon Grund [aut] (<https://orcid.org/0000-0002-1290-8986>), Thorsten Henke [ctb]
Initial release
2021-01-21 11:48:47

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.