Description Usage Arguments Details Value Examples
Calculates the distance between all tracked individuals at a given timestep. Users can choose whether to calculate distances based on a single point, or polygons representative of individuals' locations. If individuals set dataType == "Polygon", the distance matrix reported describes the shortest distances between polygons' edges (Note that the rgeos::gDistance function is used to obtain these distances).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
x |
Data frame or list of data frames containing real-time-location data. |
id |
Vector of length nrow(data.frame(x)) or singular character data, detailing the relevant colname in x, that denotes what unique ids for tracked individuals will be used. If argument == NULL, the function assumes a column with the colname "id" exists in x. Defaults to NULL. |
dateTime |
Vector of length nrow(data.frame(x)) or singular character data, detailing the relevant colname in x, that denotes what dateTime information will be used. If argument == NULL, the function assumes a column with the colname "dateTime" exists in x. Defaults to NULL. |
point.x |
Vector of length nrow(data.frame(x)) or singular character data, detailing the relevant colname in x, that denotes what planar-x or longitude coordinate information will be used. If argument == NULL, the function assumes a column with the colname "x" exists in x. Defaults to NULL. |
point.y |
Vector of length nrow(data.frame(x)) or singular character data, detailing the relevant colname in x, that denotes what planar-y or lattitude coordinate information will be used. If argument == NULL, the function assumes a column with the colname "y" exists in x. Defaults to NULL. |
poly.xy |
Columns within x denoting polygon xy-coordinates. Polygon coordinates must be arranged in the format of those in referencePointToPolygon output. Defaults to NULL. |
elev |
Vector of length nrow(data.frame(x)) or singular character data, detailing the relevant colname in x, that denotes vertical positioning of each individual in 3D space (e.g., elevation). If argument != NULL, relative vertical positioning will be incorporated into distance calculations. Defaults to NULL. |
parallel |
Logical. If TRUE, sub-functions within the dist2All wrapper will be parallelized. Defaults to FALSE. |
nCores |
Integer. Describes the number of cores to be dedicated to parallel processes. Defaults to half of the maximum number of cores available (i.e., (parallel::detectCores()/2)). |
dataType |
Character string refering to the type of real-time-location data presented in x, taking values of "Point" or "Polygon." If argument == "Point," individuals' locations are drawn from point.x and point.y. If argument == "Polygon," individuals' locations are drawn from poly.xy. Defaults to "Point." |
lonlat |
Logical. If TRUE, point.x and point.y contain geographic coordinates (i.e., longitude and lattitude). If FALSE, point.x and point.y contain planar coordinates. Defaults to FALSE. |
numVertices |
Numerical. If dataType == "Polygon," users must specify the number of vertices contained in each polygon. Defaults to 4. Note: all polygons must contain the same number of vertices. |
If dataType == "Point," users have the option of setting lonlat == TRUE (by default lonlat == FALSE). lonlat is a logical argument that tells the function to calculate the distance between points on the WGS ellipsoid (if lonlat == TRUE), or on a plane (lonlat == FALSE) (see raster::pointDistance). If lonlat == TRUE, coordinates should be in degrees. Otherwise, coordinates should represent planar ('Euclidean') space (e.g. units of meters).This function is not currently able to calculate distances between polygons on the WGS ellipsoid (i.e., if dataType == "Polygon," lonlat must = FALSE). We aim to address this issue in future versions.
Note that if inputting a separate matrix/dataframe with polygon xy coordinates (poly.xy), coordinates must be arranged in the format of those in referencePointToPolygon outputs (i.e., col1 = point1.x, col2 = point1.y, col3 =point2.x, col4 = point2.y, etc., with points listed in a clockwise (or counter-clockwise) order).
Returns a data frame (or list of data frames if x
is a
list of data frames) with the following columns:
dateTime |
The unique date-time information corresponding to when
tracked individuals were observed in |
totalIndividuals |
The total number of individuals observed at least
one time within |
individualsAtTimestep |
The number of individuals in |
id |
The unique ID of a tracked individual for which we will
evaluate distances to all other individuals observed in |
dist.to.indiv_... |
The observed distance between the individual
described in the |
1 2 3 4 5 6 7 8 9 10 11 12 13 | data(calves)
calves.dateTime<-datetime.append(calves, date = calves$date,
time = calves$time)
calves.agg<-tempAggregate(calves.dateTime, id = calves.dateTime$calftag,
dateTime = calves.dateTime$dateTime, point.x = calves.dateTime$x,
point.y = calves.dateTime$y, secondAgg = 300, extrapolate.left = FALSE,
extrapolate.right = FALSE, resolutionLevel = "reduced", parallel = FALSE,
na.rm = TRUE, smooth.type = 1) #smooth locations to 5-min fix intervals.
calves.dist2<-dist2All_df(x = calves.agg, parallel = FALSE, dataType = "Point",
lonlat = FALSE) #calculate distance between all individuals at each timepoint.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.