A circle of radius R is drawn around each point in the trajectory. The number of revisits is calculated as the number of segments of the trajectory passing through that circle.
getRecursions(
x,
radius,
threshold = 0,
timeunits = c("hours", "secs", "mins", "days"),
verbose = TRUE
)# S3 method for data.frame
getRecursions(
x,
radius,
threshold = 0,
timeunits = c("hours", "secs", "mins", "days"),
verbose = TRUE
)
# S3 method for Move
getRecursions(
x,
radius,
threshold = 0,
timeunits = c("hours", "secs", "mins", "days"),
verbose = TRUE
)
# S3 method for move2
getRecursions(
x,
radius,
threshold = 0,
timeunits = c("hours", "secs", "mins", "days"),
verbose = TRUE
)
# S3 method for MoveStack
getRecursions(
x,
radius,
threshold = 0,
timeunits = c("hours", "secs", "mins", "days"),
verbose = TRUE
)
A list with several components, revisits
and residenceTime
are vectors of the same length as the x
dataframe. revisits
is the number of revisits for each
location, where 1 means that there were
no revisits, only the initial visit. residenceTime
is the total time spent withing the radius. radius
is the specified radius used for all the calculations. timeunits
is the specified time units used to specify
timespans.
When verbose = TRUE
, additional information
is also returned, dists
and revisitStats
. Next, dists
gives the distance matrix between
all locations. Finally, revisitStats
gives further statistics on each visit. These are calculated
per location (i.e., no aggregation of nearby points is performed), and give the index and location
of the point of the track at the center of the radius, the radius entrance and exit time of the track for that
visit, how much time was spent inside the radius, and how long since the last visit (NA
for the first visit).
Either a data frame, move2, Move-class, or MoveStack object. For a data frame, the trajectory data with four columns (the x-coordinate, the y-coordinate, the datetime, and the animal id).
numeric radius to use in units of the (x,y) location data to detect recursions.
a time difference (in units timeunits
) to ignore excursions outside the radius. Defaults to 0.
character string specifying units to calculate time differences in for the time spans inside the radius and since the
visit in revisitStats
. Defaults to hours.
TRUE
to output complete information (can be large for large input data frames) or
FALSE
to output basic information.
getRecursions(data.frame)
: Get recursions for a data.frame object consisting of columns x, y, datetime, and id
getRecursions(Move)
: Get recursions for a Move-class object
getRecursions(move2)
: Get recursions for a move2 object (for details see vignette("programming_move2_object", package = "move2")
)
getRecursions(MoveStack)
: Get recursions for a MoveStack object
Chloe Bracis <cbracis@uw.edu>
For each point in the trajectory, a circle of radius R is drawn around that point. Then the number of segments of the trajectory passing through that circle is counted. This is the number of revisits, so each point will have at least one revisit (the initial visit). For each revisit, the time spent inside the circle is calculated, as well as the time since the last visit (NA for the first visit). In order to calculate the time values, the crossing time of the radius is calculated by assuming linear movement at a constant speed between the points inside and outside the circle.
Projection. Consider the projection used. Since segments are counted passing through circles
drawn around points, an equal area projection would ensure similar size comparisons (e.g., spTransform
).
Either single or multiple individuals are supported, but be aware that this function will be slow with
large amounts of data (e.g. millions of points), so consider pre-specifying the locations
(getRecursionsAtLocations
) or use clustering. Multiple individuals are handled via the id
column of the
data.frame or using a move2 or MoveStack object.
getRecursionsAtLocations
data(martin)
revisits = getRecursions(martin, radius = 1)
plot(revisits, martin, legendPos = c(10, -15))
drawCircle(10, -10, 1)
Run the code above in your browser using DataLab