#Point transect example
shapefile.name <- system.file("extdata", "TrackExample.shp", package = "dssd")
region <- make.region(region.name = "study area",
shape = shapefile.name)
# \donttest{
# Generate coverage grid (spacing quite sparse for speed)
cover <- make.coverage(region,
n.grid.points = 250)
# Define design
design <- make.design(region = region,
transect.type = "point",
design = "random",
samplers = 25,
design.angle = 45,
edge.protocol = "minus",
truncation = 3,
coverage.grid = cover)
# Generate a single survey instance
survey <- generate.transects(design)
plot(region, survey, covered.area = TRUE)
# Note, the number of reps here has been set to 5 to avoid lengthy run-times,
# however, the reps should be at least 100 for an idea of design statistics
# (i.e. trackline lengths) and 500 + to give a good odea of coverage.
design <- run.coverage(design, reps = 5)
# Plot the coverage
plot(design)
# Display the design statistics
design
#Extract coverage scores
coverage.scores <- get.coverage(design)
hist(coverage.scores)
#Multi-strata line transect example
shapefile.name <- system.file("extdata", "AreaRProjStrata.shp", package = "dssd")
region <- make.region(region.name = "study area",
strata.name = c("North", "NW", "West Upper",
"West Lower", "SW", "South"),
shape = shapefile.name)
plot(region)
# Make a coverage grid
cover <- make.coverage(region,
n.grid.points = 500)
# Define the design
design <- make.design(region = region,
transect.type = "line",
design = c("systematic", "systematic",
"eszigzag", "systematic",
"systematic", "eszigzagcom"),
line.length = 5000*1000, #5000km x 1000m (projection in m)
design.angle = c(160, 135, 170, 135, 50, 60),
edge.protocol = "minus",
truncation = 3000,
coverage.grid = cover)
# Create a single set of transects to check
survey <- generate.transects(design)
plot(region, survey, covered.area = TRUE)
# Note, the number of reps here has been set to 5 to avoid lengthy run-times,
# however, the reps should be at least 100 for an idea of design statistics
# (i.e. trackline lengths) and 500 + to give a good odea of coverage.
design <- run.coverage(design, reps = 5)
# Plot the coverage
plot(design)
# Display the design statistics
design
# Extract coverage scores for the first strata
coverage.scores <- get.coverage(design, strata.id = 1)
summary(coverage.scores)
# }
# Fast running example for CRAN testing purposes
# This spacing is too sparse to assess coverage in a real example and
# the number of repetitions is too low to assess design statistics
cover <- make.coverage(region,
n.grid.points = 50)
design <- make.design(region = region,
transect.type = "point",
design = "random",
samplers = 25,
design.angle = 45,
edge.protocol = "minus",
truncation = 3,
coverage.grid = cover)
survey <- generate.transects(design)
plot(region, survey, covered.area = TRUE)
design <- run.coverage(design, reps = 3)
plot(design)
design
Run the code above in your browser using DataLab