knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
library(emo)
This package contains:
- Tracking data from Masked boobies (Sula dactylatra) collected at Easter Island.
- Functions to clean your data and calculate the foraging trip parameters of the individuals.
The goal is that you use the data as an example and adapt your data accordingly to calculate your own foraging trip parameters. Also you can have most of the information in parallel to your original tracking data for check-ups in a GIS software.
# install.packages("devtools") devtools::install_github("MiriamLL/sula")
library(sula)
This function allows you to correct the time of the GPS according to your GMT. You need to provide your data frame, the name of you columns containing time and date, the format of those columns and the time difference between the data and your GMT. It returns hora_corregida with the corrected time.
GPS_gmt<-ajustar_hora(GPS_data = GPS_raw, dia_col = 'DateGMT', hora_col = 'TimeGMT', formato="%d/%m/%Y %H:%M:%S", dif_hor = 5)
This function allows you to cut specific periods in your data. Inicio means start, Final means end.
GPS_recortado<-recortar_periodo(GPS_data=GPS_01, inicio='02/11/2017 18:10:00', final='05/11/2017 14:10:00', dia_col='DateGMT', hora_col='TimeGMT', formato="%d/%m/%Y %H:%M:%S")
This functions identifies the location of the nest assuming that the first column is the nest location.
nest_loc<-localizar_nido(GPS_data = GPS_01, lat_col="Latitude", lon_col="Longitude")
This function adds a column with the distance from the nest, and a column to let you know if the location corresponds to a foraging trip or not. You need to give a buffer in distancia_km.
GPS_trip<-identificar_viajes(GPS_data=GPS_01, nest_loc=nest_loc, distancia_km=1)
This function gives a number to each trip and eliminates the locations that do not correspond to trips.
GPS_edited<-contar_viajes(GPS_data=GPS_trip)
This function calculates the distance from the colony of each location. Returns a new column called 'maxdist_km'.
GPS_dist<-dist_colonia(GPS_edited = GPS_edited, nest_loc=nest_loc)
This function calculates the distance between each location. Returns a new column called 'pointsdist_km'.
GPS_dist<-dist_puntos(GPS_data = GPS_edited, separador='trip_number')
This function calculates the duration of each trip. Returns a new data frame with four columns: trip_id, trip_start, trip_end y duration.
duracion<-calcular_duracion(GPS_data = GPS_edited, col_diahora = "tStamp", formato = "%Y-%m-%d %H:%M:%S", unidades="hours", separador="trip_number")
This function calculates the total distance travelled by each trip.
totaldist_km<-calcular_totaldist(GPS_data= GPS_edited, separador="trip_number")
This function calculates the maximum distance of each foraging trip.
maxdist_km<-calcular_maxdist(GPS_data = GPS_edited, nest_loc=nest_loc, separador="trip_number")
Calculates trip duration, total distance from the colony and maximum distance and returns a data frame with the information.
trip_params<-calcular_tripparams(GPS_data = GPS_edited, diahora_col = "tStamp", formato = "%Y-%m-%d %H:%M:%S", nest_loc=nest_loc, separador="trip_number")
This function allows you to cut specific periods in your data using a data frame with field information (Notas).
GPS_recortados<-recortar_por_ID(GPS_data=GPS_raw, Notas=Notas, formato="%d/%m/%Y %H:%M:%S")
This functions identifies the location of the nest from several individuals assuming that the first column is the nest location.
Nidos_df<-localizar_nidos(GPS_data=GPS_raw, lon_col="Longitude", lat_col="Latitude", ID_col="IDs")
This functions adds the columns: maximum distance from the colony per location, distance between locations, trip number
GPS_preparado<-preparar_varios(GPS_data=GPS_raw, ID_col="IDs", lon_col="Longitude", lat_col="Latitude", distancia_km=1, sistema_ref="+init=epsg:4326")
This function calculates trip parameters for several individuals.
Note to use this function, your data must be in date and time format. Otherwise you can use the function ajustar_hora to convert it to the correct object class.
GPS_preparado<-ajustar_hora(GPS_data = GPS_preparado, dif_hor = 0, dia_col = 'DateGMT', hora_col = 'TimeGMT', formato="%d/%m/%Y %H:%M:%S")
trip_params<-tripparams_varios(GPS_data=GPS_preparado, col_ID = "IDs", col_diahora="hora_corregida", separador="trip_number")
This function interpolates the data according to a set interval, your data already contains a column named Latitude and Longitude
GPS_interpolated<-interpolar_viajes(GPS_preparado = GPS_preparado, intervalo = "900 sec", columna_diahora = "dia_hora", columna_ID ='IDs', separador='trip_number')
GPS_interpolated<-interpolate_by_group(GPS_data = GPS_preparado, interval = "900 sec", column_datetime = "dia_hora", column_lat = "Latitude", column_lon = "Longitude", column_group ='IDs')
The data comes from this publication ๐
- Lerma M, Dehnhard N, Luna-Jorquera G, Voigt CC, Garthe S (2020) Breeding stage, not sex, affects foraging characteristics in masked boobies at Rapa Nui. Behavioral ecology and sociobiology 74: 149.
The package can be cited as:
- Lerma M (2021) Package sula. Zenodo. https://doi.org/10.5281/zenodo.4740920
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.