Learn R Programming

amt (version 0.1.4)

random_points: Generate random points

Description

Functions to generate random points within an animals home range. This is usually the first step for investigating habitat selection via Resource Selection Functions (RSF).

Usage

random_points(x, ...)

# S3 method for hr random_points(x, n = 100, type = "random", presence = NULL, ...)

# S3 method for sf random_points(x, n = 100, type = "random", presence = NULL, ...)

# S3 method for SpatialPolygons random_points(x, n = 100, type = "random", presence = NULL, ...)

# S3 method for track_xy random_points(x, level = 1, hr = "mcp", n = nrow(x) * 10, type = "random", ...)

Arguments

x

[track_xy, track_xyt] A track created with make_track.

...

[any] None implemented.

n

[integer(1)] The number of random points.

type

[character(1)] Argument passed to sp::spsample type. The default is random.

presence

[track] The presence points, that will be added to the result.

level

[numeric(1)] Home-range level of the minimum convex polygon, used for generating the background samples.

hr

[character(1)] The home range estimator to be used. Currently only MCP is implemented.

Examples

Run this code
# NOT RUN {
data(deer)

# track_xyt ---------------------------------------------------------------
# Default settings
rp1 <- random_points(deer)

# }
# NOT RUN {
plot(rp1)
# }
# NOT RUN {
 
# }
# NOT RUN {
trast <- raster(bbox(deer, buffer = 5000), res = 30)
rp3 <- random_points(deer, hr = "kde", trast = trast) # we need a larger template raster

plot(rp3)
# }
# NOT RUN {

# Only one random point for each observed point
rp <- random_points(deer, factor = 1)
# }
# NOT RUN {
plot(rp)
# }
# NOT RUN {
# Within a home range -----------------------------------------------------
hr <- hr_mcp(deer, level = 1)

# 100 random point within the home range
rp <- random_points(hr, n = 100)
# }
# NOT RUN {
plot(rp)
# }
# NOT RUN {
# 100 regular point within the home range
rp <- random_points(hr, n = 100, type = "regular")
# }
# NOT RUN {
plot(rp)
# }
# NOT RUN {
# 100 hexagonal point within the home range
rp <- random_points(hr, n = 100, type = "hexagonal")
# }
# NOT RUN {
plot(rp)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab