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

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 class 'track_xy'
distance_to_center(x, trast, square = TRUE, ...)

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

distance_to_centers(x, ...)

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

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)

amt

Animal Movement Tools

v0.1.4
GPL-3
Authors
Johannes Signer [aut, cre], Brian Smith [ctb], Bjoern Reineking [ctb], Ulrike Schlaegel [ctb], John Fieberg [ctb], Scott LaPoint [dtc]
Initial release

We don't support your browser anymore

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