The homdista package is designed to analyze the movement patterns of objects, like animals, using recorded GPS coordinates. This toolkit offers various functions to compute home range areas, distances traveled over extended periods, daily, monthly and yearly, and analyzing the utilized area overlaps. To determine home range, the package employs a kernel density estimator, requiring users to specify the bandwidth themselves. For distance estimation, the package utilizes the st_length function to link all points in chronological order based on their timestamps.
You can install the homdista package from GitHub with:
# install.packages("devtools")
# If you don't have devtools installed, uncomment the line above to install it first
library(devtools)
# Install the homdista package
devtools::install_github("2023Jado/homdista")# Computes monthly and yearly utilized areas and distances walked
homdista(file, crs_epsg, Id_name, timestamp, perc, parh)
# Generates polygons representing the utilized areas
homekde(file, crs_epsg, Id_name, timestamp, perc, parh)
# Calculates correlation values and visualizes the relationship between area and distance
hodicor(adista, cormethod)
# Creates line paths to visualize the traveled distances
distwalk(file, Id_name, timestamp, crs_epsg)
# Creates the line paths to visualize the daily traveled distances
daytraj(file, Id_name, timestamp, crs_epsg)
# Converts a data frame into a move object for more detailed movement analysis
moveObject(file, Id_name, timestamp, crs_epsg)
# Generates the polygons representing the yearly utilized areas
homeyear(file, crs_epsg, Id_name, timestamp, perc, parh)
# Compute the monthly utilized area overlaps
homoverlap(data, crs_epsg)
# Computes the yearly utilized area overlaps
yearoverlap(data, crs_epsg)
# Summarizing the monthly overlaps
summoverlap(file, filelap, Id_name, timestamp, crs_epsg)
# Summarizing the yearly overlaps
sumyoverlap(file, filelap, Id_name, timestamp, crs_epsg)
file dataframe which comprises at least three columns: a longitude column labeled "x", a latitude column labeled "y", in lowercase, and a timestamp column.,
timestamp timestamp Column name from dataset which shows the time of the observation.
crs_epsg EPSG code related to the dataset coordinates.
Id_name Column name from dataset which shows different categories (e.g., different groups (group A,
group B, group C, ...)).
perc The percentage utilized to calculate the KDE home range at a specific level (e.g., 50% for
core areas, 75%, 90%, 95%, ...).
parh Bandwidth or smoothing parameter.
adista A layer containing the area and distances values generated from the homdista function.
cormethod Correlation method between paired samples (pearson", "kendall", or "spearman") at
confidence level of 95%.
data When computing the monthly home range overlaps, this refers to the output of the `homoverlap` function. For yearly home range overlaps, the computation refers to the output of the `yearoverlap` function.
filelap When summarizing the monthly home range overlaps, this refers to the output of the `homoverlap` function, which contains the overlap polygons and their attributes. For yearly overlaps, the summary is based on the output of the `yearoverlap` functions.
The following are basic examples for how some of the functions works:
- Home range estimation and walked distance calculation
library(homdista)
## Read the file
file_path <- system.file("extdata", "data.csv", package = "homdista")
file <- read.csv(file_path, header=T)
## Home range area (with Kernel density estimator) and walked distance calculation
area_distance <- homdista(file, 32734, "Animal", "timestamp", 95, 500)
head(area_distance)
- Generating spatial polygons for the home range areas
library(homdista)
#Additional libraries
library(sf)
library(mapview)
## Generates polygons representing the utilized areas
homerange <- homekde(file, 32734, "Animal", "timestamp", 95, 500)
# Convert "sp" object to "sf"
Homerange <- st_as_sf(homerange)
# Define a palette for colors
palette <- rainbow(length(unique(Homerange$Id)))
#Create map with mapview
mapview(Homerange, zcol = "Id", col.regions = palette, legend = TRUE, legend.title = "", legend.values = unique(Homerange$Id))
- Get correlation values and plot the relationship between area and distance values
library(homdista)
## Home range area (with Kernel density estimator) and walked distance calculation
area_distance <- homdista(file, 32734, "Animal", "timestamp", 95, 500)
## Correlation values and plot the relationship between area and distance values using spearman method
Correlation <- hodicor(area_distance, "spearman")
Correlation
- Get the line paths to visualize the traveled distances
library(homdista)
#Additional library
library(mapview)
Distance <- distwalk(file, "Animal", "timestamp", 32734)
head(Distance)
mapview(Distance, zcol = "Id", col.regions = rainbow(length(unique(Distance$Id))), legend = TRUE, legend.title = " ", legend.values = unique(Distance$Id)))
- Daily traveled distance
library(homdista)
Daily_distance <- daytraj(file, "Animal", "timestamp", 32734)
head(Daily_distance)
- Converts a data frame into a move object for more detailed movement analysis
library(homdista)
#Additional libraries
library(sf)
library(mapview)
Move <- moveObject(file, "Animal", "timestamp", 32734)
mapview(Move)
1. Fleming, C. H., & Calabrese, J. M. (2017). A new kernel density estimator for accurate home‐range and species‐range area estimation. Methods in Ecology and Evolution, 8(5), 571-579.
2. Calenge, C. (2011). Home range estimation in R: the adehabitatHR package. Office national de la classe et de la faune sauvage: Saint Benoist, Auffargis, France.
3. Wu, X., Roy, U., Hamidi, M., & Craig, B. N. (2020). Estimate travel time of ships in narrow channel based on AIS data. Ocean Engineering, 202, 106790.
4. Pebesma, E. J. (2018). Simple features for R: standardized support for spatial vector data. R J., 10(1), 439.
5. Urbano, F., Basille, M., & Racine, P. (2014). From Points to Habitat: Relating Environmental Information to GPS Positions. Spatial Database for GPS Wildlife Tracking Data: A Practical Guide to Creating a Data Management System with PostgreSQL/PostGIS and R, 75-93.







