# NOT RUN {
# The following example will select a sample from an area resource. The design
# includes two strata. For Stratum 1, a sample of size 50 will be selected for
# a single panel. For Stratum 2, a sample of size 50 will be selected for each
# of two panels. In addition both strata will include oversamples (size 10 for
# Stratum 1 and size 75 for Stratum 2). It is assumed that a shapefile defining
# the polygons for the area resource is located in the folder from which R is
# started. Attribute data for the design will be read from the dbf file of the
# shapefile, which is assumed to have a variable named "test.stratum" that
# specifies stratum membership value for each record in the shapefile. A
# shapefile named "test.sample" containing the survey design information will be
# created.
test.design <- list("Stratum 1"=list(panel=c(Panel=50), seltype="Equal",
over=10), "Stratum 2"=list(panel=c("Panel One"=50, "Panel Two"=50),
seltype="Unequal", caty.n=c(CatyOne=25, CatyTwo=25, CatyThree=25,
CatyFour=25), over=75))
test.attframe <- read.dbf("test.shapefile")
test.sample <- irs(design=test.design, DesignID="Test.Site", type.frame="area",
src.frame="shapefile", in.shape="test.shapefile", att.frame=test.attframe,
stratum="test.stratum", mdcaty="test.mdcaty", shapefile=TRUE,
out.shape="test.sample")
# }
Run the code above in your browser using DataLab