Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

read.mask

Read Habitat Mask From File


Description

Read coordinates of points on a habitat mask from a text file.

Usage

read.mask(file = NULL, data = NULL, spacing = NULL, columns = NULL, ...)

Arguments

file

character string with name of text file

data

dataframe

spacing

spacing of grid points in metres

columns

character vector naming the columns to save as covariates

...

other arguments to pass to read.table

Details

For file input, the x and y coordinates are usually the first two values on each line, separated by white space. If the file starts with a line of column headers and ‘header = TRUE’ is passed to read.table in the ... argument then ‘x’ and ‘y’ need not be the first two fields.

data is an alternative input route if the x and y coordinates already exist in R as columns in a dataframe. Only one of data or file should be specified.

The grid cell size spacing should be provided if known. If it is not provided then an attempt is made to infer it from the minimum spacing of points. This can be slow and may demand more memory than is available. In rare cases (highly fragmented masks) it may also yield the wrong answer.

From 2.3.0, additional columns in the input are saved as covariates. The default (columns = NULL) is to save all columns.

Value

object of class mask with type ‘user’

Note

read.mask creates a single-session mask. If used in secr.fit with a multi-session capthist object a single-session mask will be replicated to the number of sessions. This is appropriate if all sessions relate to the same geographical region. If the ‘sessions’ relate to different regions you will need to construct a multi-session mask as a list of single-session masks (e.g. mask <- list(mask1, mask2, mask3)).

See Also

Examples

## Replace file name with a valid local name and remove `#'
# read.mask (file = "c:\\myfolder\\mask.txt",
# spacing = 3, header = TRUE)
## "mask.txt" should have lines like this
# x   y
# 265 265
# 268 265
# ...

secr

Spatially Explicit Capture-Recapture

v4.4.1
GPL (>= 2)
Authors
Murray Efford
Initial release
2021-05-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.