mapTrips: Make simple maps of foraging trips

View source: R/mapTrips.R

mapTripsR Documentation

Make simple maps of foraging trips

Description

mapTrips uses output from tripSplit to create maps illustrating movements for each ID.

Usage

mapTrips(trips, colony, IDs = NULL, colorBy = c("complete", "trip"))

Arguments

trips

SpatialPointsDataFrame. Must be output of tripSplit function).

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.

Details

This function only works with the output of tripSplit.

Value

Returns a figure of facetted maps, each of which corresponds to a level of ID in trips.

See Also

tripSplit

Examples

## 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


track2KBA documentation built on Sept. 27, 2023, 5:08 p.m.