if (FALSE) {
library(SamplingStrata)
data("swissmunicipalities")
swissmunicipalities = swissmunicipalities[swissmunicipalities$REG==1,]
data("errors")
swissmunicipalities$id <- c(1:nrow(swissmunicipalities))
swissmunicipalities$domain = 1
frame <- buildFrameDF(swissmunicipalities,
id = "id",
domainvalue = "REG",
X = c("Surfacesbois","Surfacescult"),
Y = c("Pop020", "Pop2040")
)
solution <- optimStrata (method = "continuous",
errors = errors,,
framesamp = frame,
nStrata = 8,
iter = 25,
pops = 10)
p <- plotStrata2d(solution$framenew,
solution$aggr_strata,
domain = 1,
vars = c("X1","X2"),
labels = c("Surfacesbois","Surfacescult"))
p
}
Run the code above in your browser using DataLab