masterSample | R Documentation |
This is the main function for selecting sites using the BAS master sample. It assumes that you have already defined the master sample using the buildMS() function or will be selecting a marine master sample site in BC.
masterSample( shp, N = 100, bb = NULL, stratum = NULL, nExtra = 5000, quiet = FALSE )
shp |
Shape file as a polygon (sp or sf) to select sites for. |
N |
Number of sites to select. If using stratification it is a named vector containing sample sizes of each group. |
bb |
Bounding box which defines the Master Sample. Default is BC Marine Master Sample. |
stratum |
Name of column of data.frame attached to shapefile that makes up the strata. |
nExtra |
An efficiency problem of how many extra samples to draw before spatial clipping to shp. |
quiet |
Boolean if you want to see any output printed to screen. Helpful if taking a long time. |
## Not run: data(Fed_MPAs_clipped) # Sample sizes for each stratum: N_Zone <- c("Adaptive Management Zone" = 30, "Marine" = 20, "Other" = 40) #chose how many sites in each polygon in the dataset # Rename the NA value as the function does not accept NA at the moment. Fed_MPAs_clipped$ZONEDESC_E[is.na(Fed_MPAs_clipped$ZONEDESC_E)] <- "Other" # Core Protection is totally within Adaptive Management Zone. Remove it or make it explicit that it is different. shp.MPAs <- Fed_MPAs_clipped[Fed_MPAs_clipped$ZONEDESC_E != "Core Protection Zone", ] # Select the Master Sample sites: smp.str <- masterSample(shp.MPAs, N = N_Zone, stratum = "ZONEDESC_E", quiet = FALSE) plot(st_geometry(shp.MPAs)) plot(st_geometry(smp.str), add = T, col= "red", pch = 16) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.