map_sites | R Documentation |
Detection of geographic regions of samples using a pixel based approach.
map_sites(x, y, z, resolution, min_size = 1)
x |
Object of class SpatVector. |
y |
Unique individual identifier for each entry in x. |
z |
Timestamps of each element in x given as a POSIXct object. |
resolution |
Maximum distance between data points to identify clusters. |
min_size |
Minimum number of GPS data points per cluster. |
The function provides three outputs. First, it labels each entry in x based on their spatial connectivity. Connections are based on resolution, which defines the maximum distance allowed among members of a group of data points, below which the elements of that group are treated as a region and labeled with the same unique, non-zero, numeric identifier. Regions where the number of data points is below min_size are labelled with a 0. Second, for each region, the function will return a polygon defined by the convex hull of the composing data points. 0-labeled regions are excluded, as well as those where the number of data points is less than 2. Third, for each region, and for each sequence of days with data points within the target region, we provide the following information and statistics:
region_id - Region unique identifier.
start.date - Segment unique identifier.
start.date - First data date.
end.date - Last data date.
day_cover_mean - Mean percentage of the days in the segment with movement data
day_cover_sd - Standard deviation of the days in the segment with movement data.
day_overlap_mean - Mean percentage of the day across which movement data were recorded.
day_overlap_sd - Standard deviation of the percentage of the day across which movement data were recorded.
nr_days - Number of days with movement data.
nr_individuals - Number of individuals tracked.
nr_records - Number of movement data records.
data_frequency_mean - Mean frequency of GPS entries (in minutes).
data_frequency_sd - Standard deviation of the frequency of GPS entries (in minutes)
Day segments are treated separately because they indicate that a given area was persistently occupied by one or more tracked individuals.
A list containing:
region.id - Vector reporting on the region each element in x belongs to.
region.polygons - Polygons for each temporal segment in each region.id.
region.stats - Statistics for each temporal segment.
{
require(terra)
# load samples
multiMove <- read.csv(system.file('extdata', 'multiMove.csv', package="rsMove"))
# convert samples to vector
multiMove = vect(multiMove, geom=c("x","y"), crs="EPSG:4326")[1:10000,]
# species identifier (only one individual, so set to 1)
species_id = multiMove$id
# data-time of species observations
date = strptime(multiMove$timestamp,format="%Y-%m-%d %H:%M:%S", tz="GMT")
# extract regions
hm <- map_sites(multiMove, species_id, date, 0.1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.