Hello !
I want to create a spatial stratified sampling scheme with the package
spsurvey. To do this with the function "grts" in spsurvey, I need to create a
list containing the specifications for each stratum. This specifications were
stored in a named list, where the name for each stratum is the name for each
list. This means, I need to create a "outer" list containing several "inner"
lists.
> Stratdsgn <- list("Stratum1"=list(panel=c(Panel=6), seltype="Equal"),
+ "Stratum2"=list(panel=c(Panel=2), seltype="Equal"),
+ "Stratum3"=list(panel=c(Panel=4), seltype="Equal"))
> str(Stratdsgn)
List of 3
$ Stratum1:List of 2
..$ panel : Named num 6
.. ..- attr(*, "names")= chr "Panel"
..$ seltype: chr "Equal"
$ Stratum2:List of 2
..$ panel : Named num 2
.. ..- attr(*, "names")= chr "Panel"
..$ seltype: chr "Equal"
$ Stratum3:List of 2
..$ panel : Named num 4
.. ..- attr(*, "names")= chr "Panel"
..$ seltype: chr "Equal"
Because I do not have only 3 strata but 50 or more I would like to create this
list with a for loop.
Could somebody help me to do this? I didn`t manged to create a list within a
list in a loop.
Thanks for every hint.
TIM
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.