xtrack-class: An xtrack object represents the movement of one individual...

xtrack-classR Documentation

An xtrack object represents the movement of one individual throughout one day.

Description

An xtrack object represents the movement of one individual throughout one day.

Fields

trackpoints

A dataframe of trackpoints

track_length_km

The length of the trajectory in km

track_duration_hr

the total duration of the xtrack in hours

Methods

as_mapview(format = c("line"), ...)

# A call to as_mapview is a thin interface to the package mapview, producing a dynamic plot that harnesses the power of package mapview. This function accepts all parameters that can be fed to the function mapview in the package mapview, such as layer.name, color, etc.

as_raster_of_habitat_visited_binary( cell_size_m = 10, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, selected_trackpoints = "all" )

Raster analysis to categorize places on the landscape as visited or not visited. This is a binary raster representation of the xtrack, where cells that are visited / intersected are given value 1, and those not visited given value 0. The length and width of the raster cells in meters is determined by the parameter cell_size_m and is by default 10. This function accepts a parameter called selected_trackpoints which determines which of the trackpoints are rasterized. The acceptable values are all, in_camp, or out_of_camp. The default is all, as used in Wood et al. 2021.

as_raster_of_habitat_visited_counts( cell_size_m = 10, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, selected_trackpoints = "all" )

Raster analysis to categorize variable visitation intensity of places on the landscape. This is a integer raster representation of the xtrack, where the count for each cell represents the number of trackpoints that fell within that cell's boundaries. Assuming that trackpoints are logged at regular time intervals, this raster provides a measure of the amount of time spent within each cell. un-visited cells are given value 0. As with the binary raster representation, the length and width of the raster cells in meters is determined by the parameter cell_size_m and is by default 10.

as_spatial_lines_dataframe()

Provides a SpatialLinesDataFrame representation of the track. This is an object type in the sp package, an important R package for spatial analysis.

get_inbound_sinuosity()

Get inbound sinuosity following the methods of Wood et al. 2021

get_longest_bout_trackpoints()

Get the trackpoints of the longest duration out of camp bout

get_out_of_camp_bout_records()

Segmentation of travel into bouts of out of camp travel. An out of camp bout is when an individual leaves camp, travels some distance, and then returns to camp.

get_outbound_sinuosity()

Get outbound sinuosity following the methods of Wood et al. 2021

get_sinuosity_measures()

Get more measures related to inbound and outbound sinuosity. These include: The length (km) of the outbound and inbound segments as traveled; the length (km) of the 'as the crow flies' distance from the point of leaving camp to the most distant point (sp_distance_outbound_km). ; The length of the 'as the crow flies' distance from the most distant point to the point of returning to camp (sp_distance_inbound_km); The mean sinuosity of the inbound and outbound segments; The trackpoint_id of the most distant (from camp centroid) trackpoint.

get_spatially_shifted_trackpoints( new_mean_lat = -3.618489, new_mean_lon = 35.06232 )

this function will return your trackpoints such that their mean lat and lon are the values you specify. Useful for sharing sensitive data.

get_trackpoints()

Returns a data frame of trackpoints. This representation has more columns / more information and annotations that the 'raw' data used to construct an xtrack. This includes columns for the time between each trackpoint, meters traveled between trackpoints, speed of travel between trackpoints, and the utm coordinates of each trackpoint.

has_data_for_sinuosity_measures()

Test if the xtrack has data sufficient to enable sinuosity calculations of the manner carried out in Wood et al. 2021.

initialize( lat, lon, elevation_m, in_camp, unix_time, distance_from_camp_m, utm_epsg, total_length_sin_criteria_m = 500, distance_from_camp_sin_criteria_m = 500 )

Creates an xtrack object. To construct an xtrack object, one must specify: the lat, lon, elevation, in-camp status, time, distance from camp centroid, whether each trackpoint is 'in camp' or not, and the utm_epsg code. lat and lon are expected to be in decimal-degree, WGS 84 format, which is the default in most GPS devices mobile devices. Elevation is expected to be in meters above sealevel. the "in_camp" parameter refers to whether each trackpoint is within or outside the boundaries of a residential area, which in Wood et al. 2021 refers to the spatial boundaries of a Hadza camp; but could more generally be considered the boundaries of a residential or habitation area, something like a village or a camp, as appropriate in a given field setting. This is useful for indicating travel for the purpose of aquiring resources – AKA foraging travel, and needed for sinuosity measures.Distance from camp centroid is expected to be the as-the-crow-flies distance from the center of a residential area or 'camp' in meters (also needed for sinuosity measures). The epsg code identifies the UTM zone of your study location. This is needed for projecting lat / lon coordinates into UTM space. To find the epsg code for your study location region of your track, check out <https://spatialreference.org/ref/epsg/>

plot_nice_map_of_track(the_title = "", line_color = "black")

A call to plot_nice_map_of_track creates a 'nice map' that harnesses ggplot2 functions. It is a clean plot of the xtrack's travel path with a simple ggplot2 black and white theme, a customized scale bar, and some metadata displayed in the subtitle area. This function accepts parameters for a title (the_title), and the color of the line representing the xtrack (line_color).

plot_sinuosity_map(the_title = "Sinuosity map")

A call to plot_sinuosity_map creates a visual representation of the outbound travel segment (red), the inbound segment (blue), travel in camp or during shorter out of camp segments (green), the 'as the crow flies' shortest path segments used to calculate sinuosity measures (grey dashed line). The trackpoint that is maximally distant from the camp centroid is plotted in yellow. The sinuosity measures themselves are plotted in the subtitle and the plot accepts a parameter for the map title.

write_gpx_file(gpx_file_name = "test.gpx", gpx_track_name = "test")

writes a GPX file representation of the track. GPX files are widely used in GIS and GPS applications.

write_kml_file( kml_file_name = "test.kml", kml_track_name = "test", color = "red", lwd = 3, kml_name = "", kml_description = "" )

Writes a KML file representation of the xtrack. KML files are used in Google Earth and elsewhere.


brianwood1/xtracks documentation built on Oct. 12, 2022, 7:42 a.m.