make.region: Creates a Region object

View source: R/Class.Constructors.R

make.regionR Documentation

Creates a Region object


This creates an instance of the Region class which defines the study area for the survey.


make.region( = "region", = character(0),
  units = character(0),
  shape = NULL, = FALSE


the region name

the strata names (character vector, same length as the number of areas in the shapefile / sf object). If not supplied "A", "B", "C", ... will be assigned. The strata names should be provided in the order they appear in the shapefile. See details.


measurement units; either "m" for metres or "km" for kilometres. If the shapefile has a projection file associated with it the units will be taken from there.


shapefile path to .shp file or an sf object of class sf, sfc or sfg.

logical indicating if the region is being created via Distance for Windows (default = FALSE). See details.


The strata names should be provided in the order the strata are presented in the shapefile or sf shape object. This can be simply checked after creating the region by plotting it and checking that the key correctly identifies the strata. Note that the order Distance for Windows displays the strata in sometimes differs from the order in which they are stored in the shapefile. If running from Distance for Windows then this will be checked and if they don't match a warning will be displayed saying that they are being re-ordered.


object of class Region


Laura Marshall


# A basic study rectangular study region
region <- make.region()

#Load the region from a projected shapefile <- system.file("extdata", "TrackExample.shp", package = "dssd")
region <- make.region( = "study area",
                      shape =

#Load a multi strata unprojected shapefile <- system.file("extdata", "AreaRStrata.shp", package = "dssd")
# Need to load shapefile first as it is not projected
sf.shape <- sf::read_sf(
# Check current coordinate reference system
# Define a European Albers Equal Area projection
proj4string <- "+proj=aea +lat_1=43 +lat_2=62 +lat_0=30 +lon_0=-9 +x_0=0 +
                y_0=0 +ellps=intl +units=km"
# Project the study area on to a flat plane
projected.shape <- sf::st_transform(sf.shape, crs = proj4string)
# Create region with default strata names
region <- make.region( = "study area",
                      shape = projected.shape)
# By plotting the region we can verify the order of the strata

dssd documentation built on Nov. 17, 2023, 5:08 p.m.