randomPoints: Randomly selected points in good habitat.

Description Usage Arguments Value Author(s) Examples

View source: R/randomPoints.R

Description

Generates the coordinates of randomly selected points in good habitat. This can be used to generate starting values for JAGS analysis.

Usage

1
randomPoints(n, JAGSmask, fixed)

Arguments

n

The number of random points required.

JAGSmask

An object of class JAGSmask which specifies the good habitat.

fixed

A 2-column matrix or data frame with fixed locations, which will be included unchanged at the top of the output matrix (if nrows(fixed) < n). Any rows in fixed with NAs will be replaced with random values. A warning is given if any locations in fixed are in bad habitat.

Value

An n x 2 matrix with the coordinates of points in suitable habitat on the scale of habMat.

Author(s)

Mike Meredith

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(simSCR)
plot(simSCR$JAGSmask)

# Create a few locations in good habitat:
( locs <- randomPoints(3, simSCR$JAGSmask) )
points(locs, pch=16)

# Treat these as fixed locations in a set of 10:
( rand <- randomPoints(10, simSCR$JAGSmask, fixed=locs) )
points(rand, pch=16, col='blue')
# Change one of the 'locs' to bad habitat
locs[2, ] <- c(2, 24)
randomPoints(10, simSCR$JAGSmask, fixed=locs) # Gives a warning.

mikemeredith/makeJAGSmask documentation built on May 19, 2021, 1:10 a.m.