Learn R Programming

amt (version 0.1.2)

dist_cent: Distance to center

Description

Distances to frequently used areas. distance_to_center calculates the distance to the home-range center (i.e., the centroid of the x and y coordinates). distance_to_centers calculates the distance to top_n most frequently used cells. Note, that the results of distance_to_center is different to distance_to_centers with top_n = 1, since in the first case the distance to the centroid is calculated and in the second case the distance to the raster cell with the most relocations.

Usage

distance_to_center(x, ...)

# S3 method for track_xy distance_to_center(x, trast, square = TRUE, ...)

# S3 method for numeric distance_to_center(x, trast, square = TRUE, ...)

distance_to_centers(x, ...)

# S3 method for track_xy distance_to_centers(x, trast, top_n = 10, square = TRUE, ...)

Arguments

x

[track_xy, track_xyt] A track created with make_track.

...

Further arguments, none implemented.

trast

[RasterLayer] A template.

square

[logical(1)] Should the distance be squared?

top_n

[integer(1)] To how many centers should the distance be calculated?

Value

RasterLayer

Examples

Run this code
# NOT RUN {
data(deer)
r <- raster::raster(bbox(deer, buffer = 100), res = 40)
d1 <- distance_to_center(deer, r)
d2 <- distance_to_centers(deer, r, top_n = 1)
d3 <- distance_to_centers(deer, r, top_n = 10)
# }

Run the code above in your browser using DataLab