Learn R Programming

DSsim (version 1.1.4)

make.region: Creates a Region object

Description

This creates an instance of the Region class. If the shapefile argument is supplied, all information will be extracted from there. Otherwise, the a list of polygons describing the areas of interest needs to be supplied (coords) and optionally a list of polygons describing the areas to be excluded (gaps). If area is not specified it will be calculated.

Usage

make.region(region.name = "region", strata.name = character(0),
  units = "m", area = numeric(0), shapefile = NULL, coords = coords
  <- list(list(data.frame(x = c(0, 0, 2000, 2000, 0), y = c(0, 500, 500, 0,
  0)))), gaps = list(), check.LinkID = TRUE)

Arguments

region.name

the region name

strata.name

the stratum names (character vector, same length as the number of areas in the shapefile or coords arguments). If not supplied "A", "B", "C", ... will be assigned.

units

measurement units; either "m" for metres or "km" for kilometres.

area

the area of the region (optional - if not supplied it will be calculated for you)

shapefile

a shapefile object of the region loaded into R using read.shapefile(shape.name) from the shapefiles library.

coords

A list with one element per stratum. Each element in the list is a list of dataframes describing the polygon coordinates. This allows multiple regions in each strata. The coordinates should start and finish with the same point. By default DSsim will create a rectangular study region 2000 m by 500 m.

gaps

A list with one element per stratum giving the areas to be excluded from the study area (the "holes"). Each element in the list is a list of data.frames describing the polygon coordinates. This allows multiple gaps in each stratum. The corrdinates should start and finish with the same point.

check.LinkID

boolean to check the order of the LinkID value in the attribute table. This is important if this shapefile was used in Distance to create the survey shapefiles as Distance would have re-ordered the strata in this way. Failing to re-order the strata will mean that the strata in DSsim will not match the transect strata ID values created by Distance. If you have created your surveys outside Distance you can turn this option off.

Value

object of class Region

Examples

Run this code
# NOT RUN {
# A basic study region of 2000m by 500m is created using the defaults
region <- make.region()
plot(region)

# Here is an example of a 1000 x 1000 study region with a gap
coords <- gaps <- list()
coords[[1]] <- list(data.frame(x = c(0,1000,1000,0,0), y = c(0,0,
 1000,1000,0)))
gaps[[1]] <- list(data.frame(x = c(400,600,500,350,400), y = c(100,
 250,600,120,100)))

region <- make.region(region.name = "study.area", units = "m", 
 coords = coords, gaps = gaps)
plot(region)

# }

Run the code above in your browser using DataLab