This function initializes a list based on size or names, with an optional initial value.
Examples
# Create a list with 3 elements
initList(3)
#> [[1]]
#> NULL
#>
#> [[2]]
#> NULL
#>
#> [[3]]
#> NULL
#>
# Create a named list initialized with NULL
initList(c("a", "b", "c"))
#> $a
#> NULL
#>
#> $b
#> NULL
#>
#> $c
#> NULL
#>
# Create a list with 2 elements initialized with 0
initList(2, 0)
#> [[1]]
#> [1] 0
#>
#> [[2]]
#> [1] 0
#>