random_points: Generate random points

Description Usage Arguments Note Examples

View source: R/random_points.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
random_points(x, ...)

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

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

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

## S3 method for class '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.

Note

For objects of class track_xyt the timestamp (t_) is lost.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
data(deer)

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

## Not run: 
plot(rp1)

## End(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)

## End(Not run)


# Only one random point for each observed point
rp <- random_points(deer, factor = 1)
## Not run: 
plot(rp)

## End(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)

## End(Not run)

# 100 regular point within the home range
rp <- random_points(hr, n = 100, type = "regular")
## Not run: 
plot(rp)

## End(Not run)
# 100 hexagonal point within the home range
rp <- random_points(hr, n = 100, type = "hexagonal")
## Not run: 
plot(rp)

## End(Not run)

amt documentation built on Jan. 18, 2021, 5:05 p.m.