run_tests <- length(strsplit(as.character(packageVersion("simPop")), "[.]")[[1]]) > 3
if(run_tests){
message("simRelation")
library(simPop)
data(ghanaS) # load sample data
ghanaS[ghanaS$region=="western","nation"] <- ghanaS[ghanaS$region=="western","nation"][1]
samp <- specifyInput(
data = ghanaS,
hhid = "hhid",
strata = "region",
weight = "weight"
)
ghanaP <- simStructure(
data = samp,
method = "direct",
basicHHvars = c("age", "sex", "relate")
)
class(ghanaP)
# simRelation",{
## long computation time ...
ghanaP <- simRelation(
simPopObj = ghanaP,
relation = "relate",
head = "head",
additional = c("nation", "ethnic", "religion"), nr_cpus = 1
)
expect_true("nation"%in%colnames(ghanaP@pop@data))
#
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.