mapTrips | R Documentation |
mapTrips
uses output from tripSplit
to create maps illustrating
movements for each ID.
mapTrips(trips, colony, IDs = NULL, colorBy = c("complete", "trip"))
trips |
SpatialPointsDataFrame. Must be output of
|
colony |
data.frame. Containing 'Latitude' and 'Longitude' fields specifying the central location(s) from which trips begin. If more than one location, each row should correspond to an appropriate location (Lat/Lon) for each ID value in trips. |
IDs |
numeric vector. Sequence of numeric indices for the IDs you wish to map. Max of 25. |
colorBy |
character string. Either "complete" if trips are to be coloured as complete or incomplete, or "trip" if trips are to be coloured by trip ID. |
This function only works with the output of tripSplit
.
Returns a figure of facetted maps, each of which corresponds to a level of ID in trips.
tripSplit
## make some play data
dataGroup <- data.frame(Longitude = rep(c(1:10, 10:1), 2),
Latitude = rep(c(1:10, 10:1), 2),
ID = c(rep("A", 20), rep("B", 20)),
DateTime = format(
lubridate::ymd_hms("2021-01-01 00:00:00") +
lubridate::hours(0:19))
)
colony <- data.frame(
Longitude = dataGroup$Longitude[1], Latitude = dataGroup$Latitude[1]
)
Trips <- tripSplit(dataGroup,
colony=colony,
innerBuff=2,
returnBuff=20,
duration=1,
nests = FALSE,
rmNonTrip = TRUE
)
## Visualize trips
mapTrips(Trips, colony) # add colony location to each facet
mapTrips(Trips, colony, colorBy = "trip") # color trips by their order
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.