<figure><img src="image_1.png" /></figure>

<figure><img src="image_2.png" /></figure>

# MoveR: An R package for easy processing and analysis of animal video-tracking data

Quentin Petitjean<sup>a, b, *</sup>, Silène Lartigue<sup>a</sup>, Mélina Cointe<sup>a</sup>, Nicolas Ris<sup>a</sup>, Vincent Calcagno<sup>a</sup>

## ARTICLE INFO

### Keywords:

Video-tracking

Trajectories

Animal Movement

Behavior

## ABSTRACT

Animal movement and behavior are critical to understanding ecological and evolutionary processes. Recent years have witnessed an increase in methodological and technological innovations in video-tracking solutions for phenotyping animal behavior. Although these advances enable the collection of high-resolution data describing the movement of multiple individuals, analyzing and interpreting them remains challenging due to their complexity, heterogeneity, and noisiness. Here, we introduce MoveR, an R package for importing, filtering, visualizing, and analyzing data from common video-tracking solutions. MoveR includes flexible tools for polishing data, removing tracking artifacts, subsetting and plotting individual paths, and computing different movement and behavior metrics.

## Metadata

<table><thead><tr><td>Nr</td><td>Code metadata description</td><td>Please fill in this column</td></tr></thead><tbody><tr><td>C1</td><td>Current code version</td><td>V0.3.0</td></tr><tr><td>C2</td><td>Permanent link to code/ repository used for this code version</td><td>https://github.com/qpetitjean/MoveR</td></tr><tr><td>C3</td><td>Permanent link to reproducible capsule</td><td>N.A.</td></tr><tr><td>C4</td><td>Legal code license</td><td>GPL-2.0 license</td></tr><tr><td>C5</td><td>Code versioning system used</td><td>git</td></tr><tr><td>C6</td><td>Software code languages, tools and services used</td><td>R</td></tr><tr><td>C7</td><td>Compilation requirements, operating environments and dependencies</td><td>O.S.: Linux, OS X, Microsoft Windows Software: R (&gt;= 3.6.2) Package dependencies: graphics*; grDevices*; hexbin; progress; R.matlab; reticulate; stats*; trajr; pracma. *Included in R v3.6.2 and above.</td></tr><tr><td>C8</td><td>If available, link to developer documentation/manual</td><td>https://qpetitjean.github.io/MoveR/</td></tr><tr><td>C9</td><td>Support email for questions</td><td>mailto:quentin.petitjean@inrae.fr; q. petitjean1@gmail.com</td></tr></tbody></table>

## 1. Motivation and significance

### 1.1. Scientific motivation

Studying animal movement patterns and behaviors is paramount to understanding ecological and evolutionary processes and developing effective species management strategies. Animal movements and behavior are often considered the first response to environmental changes or stressful conditions (e.g., pollution, climate change, introduction of non-native species) [1,2], making them valuable tools to infer underlying animal's internal states, sensory biases, and behavioral types. Therefore, changes in movement patterns and behavioral traits are increasingly considered a highly integrative and relevant endpoint to assess the effect of global changes and anthropogenic stress on organisms (e.g., ecotoxicology, conservation biology) [3–5].

In addition, behavior being at the direct interface between organisms and the environment, behavioral changes can drastically affect individual and species interactions [6] through, for instance, alterations in habitat choice, movements, foraging, social and reproductive behavior [7] with expected cascading effects on population dynamics, food webs [8], and ecosystem functions such as primary production, transport of nutrients, and hence biogeochemical cycling [9]. While animal movement and behavioral changes can directly alter ecosystem functioning,

<footnote><sup>a</sup> INRAE, CNRS, Institut Sophia Agrobiotech, Université Côte d'Azur, Sophia Antipolis, France</footnote>

<footnote><sup>b</sup> Centre de Recherche sur la Biordiversité et l'Environnement (CRBE), UMR5300, Université de Toulouse, CNRS, IRD, Toulouse INP, Université Toulouse 3- Paul Sabatier (UT3), Toulouse, France</footnote>

<footnote>* Corresponding author at: INRAE, CNRS, Institut Sophia Agrobiotech, Université Côte d'Azur, Sophia Antipolis, France. E-mail addresses: quentin.petitjean@inrae.fr, q.petitjean1@gmail.com (Q. Petitjean).</footnote>
they may also prevent rapid population decline through adaptive responses, facilitating genetic adaptation through rapid evolution [1,10], or rather the opposite, resulting in population decline and even extinction when altered in a maladaptive way (sensu ecological & evolutionary traps; [1,11,12]). Accordingly, improving our understanding of how animals move and behave in various contexts may help to tackle critical conservation aims [13,14], including the need to stabilize or increase the numbers of small or declining populations [15,16], ensure the dispersal of biocontrol agents under various conditions [17,18] and control invasive or pest species [19,20]. For instance, a recent study has shown that combining biopesticides (i.e., essential oils) and biocontrol agents (Trichogramma evanescens) to mitigate pest species in agricultural fields may be counter-productive by altering biocontrol agents' fitness and behavior and hence their efficiency [17].

Overall, what appears as subtle effects on individuals' behavior may significantly affect ecosystems' functioning, evolutionary responses, and population persistence, stressing the need to study global changes' direct and indirect effects on animal behavior. In line with these needs, the increasing use of computer vision approaches, such as automated video-tracking, occurring over the past decade has enabled the collection of high-resolution movement data easily and quickly. In addition, recent methodological and technological innovations, mainly through the implementation of artificial intelligence and machine learning algorithms to video-tracking solutions, have empowered the amount of data collected, allowing, for instance, to track large groups of unmarked individuals simultaneously (e.g., idtracker.ai [21] and TRex [22]). Many open-source tracking solutions now exist and are under active development with great potential for the experimental study of animal behavior (for a recent review, see [23]). However, analyzing and interpreting the data obtained through automated tracking solutions can remain challenging due to their complexity, heterogeneity, and noiselessness. In practice, some (possibly substantial) pre-processing is required to make sense of the raw video-tracking data.

To address these challenges and promote the widespread use of video-tracking analyses, we developed MoveR, an R package [24] for importing, filtering, analyzing, and visualizing animal movement and behavior data obtained from common video-tracking solutions such as AnimalTA, Ctrax, Idtracker.ai, and TRex. MoveR includes a suite of flexible tools helping to clean data by removing suspected tracking errors/artifacts and computing a range of metrics for quantifying animal movement and behavior (e.g., speed, average neighbor distance). MoveR also allows the computation of the mean and net square displacement values [25,26], which is helpful in inferring population dispersal. In addition, the package includes an original unsupervised learning method relying on density-based clustering [27] for classifying activity states (active vs. inactive) in a two-dimensional space instead of the classic method, generally based on arbitrary thresholds of traveled distance or speed.

To illustrate the utility of MoveR, we present a case study using video-tracking of a group of parasitoid micro-wasps (Trichogramma sp.) exposed to a linear temperature ramp increasing from 35 to 45 degrees Celsius and then decreasing back to 35 degrees. We show how MoveR can remove artifactual noise in the data, compute movement and behavior metrics, especially identifying activity states, and thus estimate temperature tolerance thresholds. Our results underline the utility of MoveR in improving the reproducibility and reliability of animal movement and behavior data analyses and in facilitating the deployment of video-tracking techniques in an era of open science.

## 1.2. Related work

With the growing interest in the field of movement and behavioral studies, some proprietary commercial software (e.g., Ethovision [28], LoliTrack - Loligo Systems ApS, Viborg, Denmark), and more recently open source (e.g., AnimalTA [29], ToxTrack [30]), video-tracking solutions have implemented the possibility of running some data

processing, computation, and visualization. However, the often expensive commercial solutions and, more generally, interface-based programs, including free ones, based on point & click interfaces with limited flexibility, do not integrate the statistical tools that the constantly evolving R community proposes.

On the other hand, several open-source R packages have been developed over the past years. However, they mainly focus on simulating animal movement [31] or analyzing spatial data retrieved from GPS chipsets/collars or ARGOS markers by investigating space use and habitat selection by wildlife (e.g., adehabitat suite, amt, move2) [32–36], or identifying behavioral states by fitting State-space [37] or hidden Markov models [38,39] (for review see [40]). While recent development of the trackdf R package [41] allows the creation of a data frame (tibble) class containing tracking data (including GPS data) and plotting them, to our knowledge, the only R packages that preceded MoveR in analyzing animal movement in such a flexible way are trajr [42], sftrack [43] and celltrackR [44]. However, while implementing the possibility of computing several interesting metrics (e.g., speed, sinuosity) to analyze animal trajectories (i.e., a set of time-specific discrete locations, generally restricted to two spatial dimensions), trajr and sftrack lack some useful functionalities that may help both beginners and advanced user, for instance, to import raw tracking data from various tracking software and then filter/clean them into R environment. Similarly, although celltrackR enables the user to filter/clean and perform computations similar to trajr, sftrack does not support importing raw tracking data from different tracking softwares and lacks the ability to investigate how a particle moves across regions of interest (ROI).

Accordingly, while several packages aiming at investigating animal movements already exist on the R platform, to date, none of them implement a full solution to perform data importation, pre-processing steps of raw tracking data through detecting and filtering potential tracking artifacts (e.g., spurious detections or changes in individual identity), handling regions of interest or analyze temporal trends across multi-individual tracking sessions, which is crucial for studying behavior in changing environments (see Illustrative examples section below). For these reasons, MoveR intends to fill the gaps by providing a complete workflow that allows easy import, management, filtering, evaluation, analysis, and visualization of automated video-tracking solutions' output in a flexible, reproducible, reliable, and open framework as required to push forward the shift toward open science that has been initiated in ecology, evolution and related fields of research [45–47].

## 2. Software description

The MoveR R package is developed within the R environment, an open-source platform [24] that is continuously evolving and has been overgrown in the past years through user-contributed packages, especially in ecology [48]. MoveR is fully coded in the base R language, meaning it does not need any compilation. It is highly portable (available for Linux, OS X, and Microsoft Windows) and only relies on few

<table><caption>**Table 1**
MoveR dependencies</caption><thead><tr><td>Dependencies</td><td>Functions</td></tr></thead><tbody><tr><td>graphics*</td><td>Display graphical elements.</td></tr><tr><td>grDevices*</td><td></td></tr><tr><td>hexbin</td><td></td></tr><tr><td>progress</td><td>Display a progress bar showing the advancement of the computations.</td></tr><tr><td>reticulate</td><td>Import Python formatted data.</td></tr><tr><td>R.matlab</td><td>Import Matlab formatted data.</td></tr><tr><td>stats*</td><td>Perform basic calculations.</td></tr><tr><td>pracma</td><td>Perform advanced calculations.</td></tr><tr><td>trajr</td><td>Compute basic movement descriptors (e.g., speed, sinuosity).</td></tr><tr><td colspan="2">*Included in R v3.6.2 and above</td></tr></tbody></table>
dependencies (Table 1).

As the focal object tracked through video-tracking software may be
from various taxonomic groups or any moving object, we will refer to
the term "particle" to specify the focal object/animal tracked hereafter.

## 2.1. Software architecture

MoveR architecture relies on six main functionalities (Fig. 1), providing tools (R functions) to (i) import raw data output from various video-tracking software (Fig. 1, blue-green box), (ii) visualize pre- and post-processed tracklets (i.e., fragments of the track/trajectory followed by a moving particle), (iii) manage regions of interest (ROI), (iv) evaluate the detection rate over the tracking process using particles' positions manually annotated, (v) clean/filter potential tracking artifact due to the experimental design, the study system (i.e., the focal species) or the tracking algorithm based on user-defined filters (Fig. 1, blue boxes). Finally, (vi) the MoveR workflow enables the analysis of particles' tracklets through the computation of basic or more advanced metrics describing animal movements (Fig. 1, purple boxes). For example, advanced functionalities allow the unsupervised classification of activity states, the computation of sociability index or population dispersal (i.e., MSD and Dcoef), the computation of temporal trends, and the identification of particular motifs of behavioral states or changes in areas' locations. In addition, the resulting output is compatible with various R packages to conduct further statistical tests and modeling classically used in ecology and evolution (e.g., [49]).

## 2.2. Software functionalities

MoveR provides a highly flexible and unified environment relying on six main functionalities, including explicitly named functions using camelCase programming conventions (see Fig. 1 and Table 2).

Briefly, the **import** functionality allows raw data integration from software like Ctrax and idtracker.ai using intuitive read functions returning an S3 "tracklets" object (e.g., readCtrax).

**The visualize** functionality allows displaying pre- or post-processed tracklets using `drawTracklets` function, which supports various customizations, including adding elements like ROI or arena boundaries.

**The manage ROI** functionality allows importing the location of area edges from a distance matrix generated using an image processing program (e.g., [50]) through the `locROI` function or by specifying it from scratch using `circles` or `polygons` functions. Once ROIs are specified, the `assignROI` function can retrieve the particles' location among them.

**The clean/filter** functionality allows filtering the data according to user-defined functions using the `filterFunc` function and passed to `filterTracklets`. Indeed, potential tracking artifacts or identity switching may depend on experimental design or a particular system/focal species. A quantitative summary of filtered data is also provided at the end of the filtering process.

**The evaluate** functionality allows computing a quantitative summary of the video and tracking statistics (e.g., video duration, the number of tracklets, and their length and duration) through the call to the `summary` function. It also allows to assess video-tracking and filtering process accuracy by comparing manual and automated

<figure><img src="image_3.png" /><figcaption>**Fig. 1.** MoveR package workflow and six main functionalities: import, visualize, manage ROI, evaluate, clean/filter, and analyze.</figcaption></figure>
<caption>**Table 2**</caption>

Main functions provided by the MoveR package and quick description of what they help to achieve.

<table><thead><tr><th>Functions</th><th>What it does</th><th>Details/Equations</th></tr></thead><tbody><tr><td><strong>IMPORT</strong></td><td></td><td></td></tr><tr><td>readAnimalTA()</td><td>Import AnimalTA tracking output .csv file.</td><td>http://vchiara.eu/index.php/animalta</td></tr><tr><td>readCtrax()</td><td>Import Ctrax tracking output .mat file.</td><td>https://ctrax.sourceforge.net/</td></tr><tr><td>readIdtracker()</td><td>Import idtracker.ai tracking output .npy file.</td><td>https://idtracker.ai/en/latest/index.html</td></tr><tr><td>readPlain()</td><td>Import plain tracking output from a table.</td><td></td></tr><tr><td>readTrackR()</td><td>Import TrackR tracking output .csv file.</td><td>https://swarm-lab.github.io/trackR/index.html</td></tr><tr><td>readTrex()</td><td>Import Trex tracking output .npz files.</td><td>https://trex.run/</td></tr><tr><td><strong>VISUALIZE</strong></td><td></td><td></td></tr><tr><td>drawTracklets()</td><td>Display tracklets on a plot.</td><td></td></tr><tr><td><strong>MANAGE ROI</strong></td><td></td><td></td></tr><tr><td>assignROI()</td><td>Assign ROI(s) identity to a particle's position.</td><td></td></tr><tr><td>circles()</td><td>Generate points located on a circle's contour and draw circle(s).</td><td></td></tr><tr><td>locROI()</td><td>Locate ROI.</td><td></td></tr><tr><td>polygons()</td><td>Generate points located on polygon vertices and draw polygon(s).</td><td></td></tr><tr><td><strong>CLEAN/FILTER</strong></td><td></td><td></td></tr><tr><td>filterFunc()</td><td>Create and test a custom filter on tracklets.</td><td></td></tr><tr><td>filterTracklets()</td><td>Apply a custom filter on tracklets.</td><td></td></tr><tr><td>mergeFilters()</td><td>Merge condition tests (i.e., filterFunc outputs).</td><td></td></tr><tr><td>resampTracklets()</td><td>Resampling tracklets.</td><td></td></tr><tr><td><strong>EVALUATE</strong></td><td></td><td></td></tr><tr><td>detectPerf()</td><td>Compute sensitivity index for particles detection.</td><td></td></tr><tr><td>trackStats()</td><td>Summary statistics of the tracking data.</td><td></td></tr><tr><td><strong>ANALYSE: BASIC DESCRIPTORS</strong></td><td></td><td></td></tr><tr><td>activity1()</td><td>Determine active or inactive states according to the speed of particles along its trajectory.</td><td></td></tr><tr><td>analyseTracklets()</td><td>Perform custom computation over a tracklet list.</td><td></td></tr><tr><td>dist2Edge()</td><td>Compute the distance from the particle to the edge of an object (e.g., the arena) over its trajectory.</td><td>User can specify its own formula, although, a solution for circular arena is already implemented as follow:</td></tr><tr><td>dist2Pt()</td><td>Compute euclidean distance between a particle and object(s).</td><td></td></tr><tr><td>distTraveled()</td><td>Compute the distance traveled by a particle over a trajectory.</td><td></td></tr><tr><td>sinuosity()</td><td>Compute corrected rediscretized sinuosity index for a given tracklet.</td><td></td></tr><tr><td>speed()</td><td>Compute particle's speed over a trajectory.</td><td></td></tr><tr><td>turnAngle()</td><td>Compute particle's turning angle over a trajectory.</td><td></td></tr><tr><td><strong>ANALYSE: HIGH-ORDER DESCRIPTORS</strong></td><td></td><td></td></tr><tr><td>activity2()</td><td>Determine active or inactive states according to density-based clustering method.</td><td></td></tr><tr><td>ANND()</td><td>Compute the Average Nearest Neighbour Distance (ANND) among tracklets.</td><td></td></tr><tr><td>exploredArea()</td><td>Compute the total surface explored and display the corresponding heatmap.</td><td></td></tr><tr><td>MSD()</td><td>Compute the mean square displacement according to Kareiva &amp; Shigesada (1983) or Turchin (2015). The Turchin's equation is a simplified version of the Kareiva &amp; Shigesada' equation, assuming symmetric turning angles.</td><td></td></tr><tr><td>DCoef()</td><td>Compute the net square displacement (population spread) according to Kareiva &amp; Shigesada (1983) or Turchin (2015). Turchin's equation is a simplified version of Kareiva &amp; Shigesada' equation, assuming symmetric turning angles.</td><td></td></tr></tbody></table>

(continued on next page)
<table><caption>**Table 2 (continued)**</caption><thead><tr><th>Functions</th><th>What it does</th><th>Details/Equations</th></tr></thead><tbody><tr><td colspan="3"><strong>ANALYSE: TEMPORAL TRENDS</strong></td></tr><tr><td>temporalTrend()</td><td>Perform analysis across tracklets and time.</td><td></td></tr><tr><td>temporalBoot()</td><td>Compute 95 % studentized CI across tracklets and time.</td><td></td></tr><tr><td colspan="3"><strong>ANALYSE: IDENTIFY MOTIFS</strong></td></tr><tr><td>IdStateSeq()</td><td>Identify and extract specified patterns/sequences from tracklets.</td><td>Use regular expressions (regex) to identify and capture patterns over tracklets.</td></tr></tbody></table>

r radius of the (circular) arena.

$d_{jc}$ distance between the point j (particle) and the center of the (circular) arena.

$x_i$ & $y_i$ x and y coordinates of point i (an object).

$x_j$ & $y_j$ x and y coordinates of point j (a particle).

$x_c$ & $y_c$ x and y coordinates of the arena center (a circle).

$x_e$ & $y_e$ x and y coordinates of the arena edge (a circle).

$x_j + P$ & $y_j + P$ x and y coordinates of point j plus the step between consecutive points.

b step length coefficient of variation.

c measure of tortuosity.

p mean step length.

$x(t)$ & $y(t)$ x and y-coordinates as a function of time.

$\frac{dx(t)}{dt}$ & $\frac{dy(t)}{dt}$ rate of change of x and y-coordinates.

$\theta$ angle for a given complex number.

$m_1$ average displacement per step.

$m_2$ average square displacement per step.

a mean activity rate.

s average sine of turning angle per step.

$\varphi$ average cosine of turning angle per step.

detections using the `detectPerf` function (i.e., check the amount of true and false detection compared to manual annotation).

The analyze functionality is versatile and enables a wide range of calculations, either pre-set (e.g., speed) or user-defined on tracklets, time, or space (e.g., across areas) and behavioral state (e.g., among activity states) using functions like `analyseTracklets` and `temporaLTrends` and `idStateSeq`. Here, four types of functions can be described:

- Basic descriptors can help to compute classic metrics over tracklets, such as speed and sinuosity.

- High-order descriptors can help to characterize activity states (i.e., active vs. inactive states) using unsupervised learning methods with the `activity2` function according to the density-based clustering

method reported in [27] and implemented by [51]. Alternatively, it also makes possible to compute the expected diffusion coefficient, a proxy of population dispersal, assuming a correlated random walk model using the `Dcoef` function according to [25,26].

- The `temporalTrend` function returns the results of a given calculation (weighted by tracklet length or not) over time by averaging the value for a given time window over each tracklet. Furthermore, computing a studentized 95 % confidence interval by bootstrapping over the tracklets is also possible with the `temporalBoot` function.

- The `idStateSeq` function helps to identify and extract arbitrary patterns regarding changes among behavioral states, spatial regions or areas of interest, patch crosses, or any other motifs using a versatile regular-expression syntax.

<figure><img src="image_4.png" /><figcaption>**Fig. 2.** Frames extracted from a video recording of 24 parasitic micro-wasps (genus *Trichogramma*) placed in a thermostated circular arena (left). Temperature ramp over which the movements of parasitic micro-wasp were recorded. The shaded area corresponds to the part of the data removed from the original dataset (i.e., moments where the temperature was below 35°C), while the white area corresponds to the remaining data used in the following example (right).</figcaption></figure>
<figure><img src="image_5.png" /><figcaption>**Fig. 3.** Particle trajectories are colored according to their location among four circular ROIs. Colors indicate the ROI. where particles are detected. As larger ROIs include smaller ones, particles at the arena's center are considered within the ROI 1, 2, 3, and 4.</figcaption></figure>

MoveR offers extensive functionalities addressing various objectives; however, the upcoming example will highlight only common procedures. For the installation procedure, more examples, and tutorials on how to benefit from MoveR's potential, See the package documentation website built with pkgdown [52]: https://qpetitjean.github.io/MoveR/.

### 3. Illustrative examples

For this example, we download and import a sample dataset from the MoveR package using the `DLsampleData` and `readTrex` functions (full code is provided in supplementary material).

Briefly, the dataset consists of video recording (1920×1080 pixels) of 24 parasitic micro-wasp individuals (genus *Trichogramma*) placed in a circular arena (diameter: 2.5cm, see [53]) for 110 minutes at 25 fps (see the left panel of Fig. 2). Over the exposure duration, the temperature

steadily increased from 18°C to 45°C and then decreased back to 18°C (temperature changing rate: 0.5°C per minute). Individuals were then tracked using TRex (v1.1.3) [22]. To reduce space allocation and computing time, we reduced the dataset by removing the movements recorded below 35°C (see the right panel of Fig. 2).

Here, we aim to clean the dataset, assign ROI identities to particle locations, compute basic descriptors, and identify activity states (active vs. inactive) on micro-wasps movements to display temporal trends. In other words, we want to identify the moments where the general pattern of micro-wasps movement changes.

After importing (`readTrex` function, for code, see supplementary material 2. Importing the data) and cleaning the dataset by removing infinite values (i.e., undetected or lost particles), and spurious detection performed outside the arena (for code, see supplementary material 3. Cleaning the data), we are generating the coordinates of several circular ROI with increasing distance to the center of the arena (for code, see supplementary material 4. Identify the tracklets within an ROI). Then, using `assignROI`, we assign the ROI's identity to the particles' position and visualize the tracklets using the `drawTracklets` function (see Fig. 3). As the ROIs are circular and the larger ones include smaller ones, a particle detected within the center of the arena (ROI_1 in Fig. 3) is also included within the larger ROIs (e.g., particles in ROI_1 are also included in ROI_2, 3 and 4, see Fig. 3).

Next, we are computing some basic descriptors such as the speed, turning angle, turning angle variance, and sinuosity (using `speed`, `turnAngle` and `sinuosity` functions, respectively; for code, see supplementary material 5.1. Compute basic descriptors).

The previous basic descriptors then enable to identify the activity states based in a two-dimensional space (i.e., the speed and the variance of the turning angle; for code, see supplementary material 5.2 Activity states: 2D non-hierarchical clustering) using the `activity2` function. This method uses the density-based clustering algorithm from [22] and implemented by [41] to detect two clusters, assuming inactive states fit a Gaussian distribution. States within the 95 % confidence ellipsis or below its major and minor radii are labeled inactive (0), and others as active (1) (See Fig. 4).

<figure><img src="image_6.png" /><figcaption>**Fig. 4.** 3d density map of the active and inactive states according to the non-hierarchical classification (density-based clustering) performed on smoothed particles speed (log-transformed) and turning angle variance (A) and representation of a sample of active (B, upper panel) and inactive (B lower panel) parts of particles trajectories (i.e., 2000 tracklets). In the 3D density map (A), the active and inactive state distributions are respectively represented as a gradient of dark green to white and dark red to white according to the increasing number of counts. Also, for the representation of the active and inactive parts of a sample of the particles' trajectories (B), we can observe that the active tracklets are generally longer than the inactive parts.</figcaption></figure>
<figure><img src="image_7.png" /><figcaption>**Fig. 5.** Evolution of the sinuosity (A) speed (B) and activity (C) of *Trichogramma* individuals (dark red line) and studentized 95 % confidence interval (light red envelope) over time (expressed in frame). The dashed line indicates when the maximum temperature has been reached over the ramp: 45°C.</figcaption></figure>

We then analyze the changes of previous descriptors over time using `temporalTrend` and `temporalBoot` functions, yielding a trend and a studentized 95 % confidence interval. (For code, see supplementary material 5.3 Compute and draw temporal trends).

Finally, we can graphically (in this example) retrieve the moment at which movements start to decrease or even stop, as shown by both the evolution of the sinuosity (Fig. 5A), the speed (Fig. 5B), and the activity rate (Fig. 5C) of the individuals over time.

## 4. Impact

The tools developed in the MoveR package workflow are designed to ease the management and analysis of video-tracking data for beginners and advanced users. By providing an efficient analysis pipeline, MoveR should pave the way for the increasing use of movement and behavioral data to tackle emergent questions encompassing the fields of ecology, evolution, and conservation biology. Here, we provide some examples of applications, but MoveR usages are not limited to these examples and may expand to a broader extent.

More precisely, MoveR can be used to investigate a large array of questions related to, for instance, the variability of responses among species, populations, or individuals by providing the necessary tools for animal video phenotyping. Indeed, while inter-specific variability of responses has been studied extensively, understanding the ecological drivers and effects of intra-specific variability on population dynamics and ecosystem functioning is still an emerging research field that needs further investigations [8,54]. While advances in machine learning algorithms conserving the identity of individuals within a group are growing, MoveR can efficiently allow specifying a reproducible and customized workflow for running computation among several individuals (i.e., tracklets) to, for instance, investigate further questions related to animal personality and syndromes [55–57] under laboratory or mesocosms settings.

In addition, under the context of global changes, the increasing use of synthetic compounds (especially in agricultural fields [58,59]) and the release of micropollutants such as pharmaceuticals [60], endocrine disruptors [61] or nanoparticles [62], and microplastics [63] MoveR represent an efficient tool to assess movements and behavioral alterations caused by such compounds on terrestrial and aquatic fauna. Indeed, the effects of contaminants and, more generally, multiple stressors and their interactive effects on animals' movement and behavior have largely been overlooked until recently, despite a clear relationship between behavioral alteration and cascading effects on individual and population fitness [4,5,64]. MoveR can hence help ecophysiologists and ecotoxicologists assess the effects of various stress (e. g., xenobiotics, parasitism, temperature changes) in animals by finding relevant and sensitive endpoints related to animal movement and

behavior.

Finally, MoveR can be useful for conservation purposes by, for instance, helping to better understand how environmental or social factors affect movements and predict the dispersion of invasive populations (i.e., progression front) [23] or biocontrol agents (i.e., pest-suppression performance) [65] through video-phenotyping methods.

## 5. Conclusions

Collection, analyses, and resulting interpretations of movement and behavioral data overlap the boundaries of several disciplines. Yet, the difficulties encountered in easily and efficiently managing such a large amount of data still prevent us from tackling emerging questions linked to fundamental ecology and evolution and their application to conservation biology. For this reason, giving scientific and conservation manager communities access to a flexible, reliable, and open framework is critical. MoveR includes a suite of flexible tools for importing, cleaning, and filtering raw data from several video-tracking softwares and allows computation of basic and more advanced metrics to quantify animal movement and behavior easily within a reproducible environment.

### CRediT authorship contribution statement

**Quentin Petitjean:** Conceptualization, Data curation, Formal analysis, Investigation, Methodology, Software, Validation, Visualization, Writing – original draft, Writing – review & editing. **Silène Lartigue:** Conceptualization, Investigation, Methodology, Software, Writing – review & editing. **Mélina Cointe:** Investigation, Methodology, Software, Writing – review & editing. **Nicolas Ris:** Conceptualization, Funding acquisition, Investigation, Project administration, Supervision, Writing – review & editing, Resources. **Vincent Calcagno:** Conceptualization, Funding acquisition, Investigation, Methodology, Project administration, Resources, Software, Supervision, Validation, Writing – review & editing.

### Declaration of competing interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

### Data availability

The data used to illustrate the use of the MoveR package in this article is hosted in the following GitHub repository: https://github.
com/qpetitjean/MoveR_SampleData, and can be directly imported into the R environment using the `DLSampleData` function of the MoveR package. The code used to illustrate the use of the MoveR package in this article is included in the supplementary material. However, a more extensive version of this example/tutorial can be found in the "How to" section of the package documentation website built with pkgdown [52]: https://qpetitjean.github.io/MoveR/

## Acknowledgments

This work was funded by the TripTIC and BIDIME projects (ANR-14-CE18-0002 to JY Rasplus and ANR ECOPHYTO « Maturation » ANR-19-ECOM-0010 to N.R.). We thank anonymous reviewers for their kind and insightful comments on a previous version of the manuscript and package. Louise VAN OUDENHOVE, Martin BERNET, and Renée LE CLECH for helpful discussions at various stages of this package development.

## Supplementary materials

Supplementary material associated with this article can be found in the online version at doi:10.1016/j.softx.2024.101674.

## References

[1] Wong BBM, Candolin U. Behavioral responses to changing environments. Behav Ecol 2015;26:665-73. https://doi.org/10.1093/beheco/aru183.

[2] Rahman T, Candolin U. Linking animal behavior to ecosystem change in disturbed environments. Front Ecol Evol 2022:10. https://doi.org/10.3389/fevo.2022.893453.

[3] Little EE, Finger SE. Swimming behavior as an indicator of sublethal toxicity in fish. Environ Toxicol Chem 1990;9:13-9. https://doi.org/10.1002/etc.5620090103.

[4] Peterson EK, Buchwalter DB, Kerby JL, LeFauve MK, Varian-Ramos CW, Swaddle JP. Integrative behavioral ecotoxicology: bringing together fields to establish new insight to behavioral ecology, toxicology, and conservation. Curr Zool 2017;63:185-94. https://doi.org/10.1093/cz/zox010.

[5] Bertram MG, Martin JM, McCallum ES, Alton LA, Brand JA, Brooks BW, Cerveny D, Fick J, Ford AT, Hellström G, Michelangeli M, Nakagawa S, Polverino G, Saaristo M, Sih A, Tan H, Tyler CR, Wong BBM, Brodin T. Frontiers in quantifying wildlife behavioural responses to chemical pollution. Biol Rev 2022. https://doi.org/10.1111/brv.12844. n/a.

[6] Bartley TJ, McCann KS, Bieg C, Cazelles K, Granados M, Guzzo MM, MacDougall AS, Tunney TD, McMeans BC. Food web rewiring in a changing world. Nat Ecol Evol 2019;3:345-54. https://doi.org/10.1038/s41559-018-0772-3.

[7] Tuomainen U, Candolin U. Behavioural responses to human-induced environmental change. Biol Rev Camb Philos Soc 2011;86:640-57. https://doi.org/10.1111/j.1469-185X.2010.00164.x.

[8] Moran NP, Wong BBM, Thompson RM. Weaving animal temperament into food webs: implications for biodiversity. Oikos 2017;126:917-30. https://doi.org/10.1111/oik.03642.

[9] Bakker ES, Wood KA, Pagés JF, Veen GFC, Christianian MJA, Santamaría L, Nolet BA, Hilt S. Herbivory on freshwater and marine macrophytes: A review and perspective. Aquat Bot 2016;135:18-36. https://doi.org/10.1016/j.aquabot.2016.04.008.

[10] Calcagno V, Dubosclard M, de Mazancourt C. Rapid exploiter-victim coevolution: the race is not always to the swift. Am Nat 2010;176:198-211. https://doi.org/10.1086/653665.

[11] Robertson BA, Rehage JS, Sih A. Ecological novelty and the emergence of evolutionary traps. Trends Ecol Evol 2013;28:552-60. https://doi.org/10.1016/j.tree.2013.04.004.

[12] Schlaepfer MA, Runge MC, Sherman PW. Ecological and evolutionary traps. Trends Ecol Evol 2002;17:474-80. https://doi.org/10.1016/S0169-5347(02)02580-6.

[13] Greggor AL, Blumstein DT, Wong BBM, Berger-Tal O. Using animal behavior in conservation management: a series of systematic reviews and maps. Environ Evid 2019;8:23. https://doi.org/10.1186/s13750-019-0164-4.

[14] Fraser KC, Davies KTA, Davy CM, Ford AT, Flockhart DTT, Martins EG. Tracking the conservation promise of movement ecology. Front Ecol Evol 2018;6. https://www.frontiersin.org/articles/10.3389/fevo.2018.00150 (accessed June 2, 2023).

[15] Clobert J, Galliard JFL, Cote J, Meylan S, Massot M. Informed dispersal, heterogeneity in animal dispersal syndromes and the dynamics of spatially structured populations. Ecol Lett 2009;12:197-209. https://doi.org/10.1111/j.1461-0248.2008.01267.x.

[16] Cote J, Clobert J. Social personalities influence natal dispersal in a lizard. Proc R Soc B Biol Sci 2006;274:383-90. https://doi.org/10.1098/rspb.2006.3734.

[17] van Oudenhove L, Cazier A, Fillaud M, Lavoir AV, Fatnassi H, Perez G, Calcagno V. Non-target effects of ten essential oils on the egg parasitoid *Trichogramma evenscens*. Peer Community J 2023;3. https://doi.org/10.24072/pcjournal.212.

[18] Cointe M, Burte V, Perez G, Mailleret L, Calcagno V. A double-spiral maze and resolution tracking pipeline to study dispersal by groups of minute insects. Sci Rep 2023;13:5200. https://doi.org/10.1038/s41598-023-31630-8.

[19] Duckworth RA, Badyaev AV. Coupling of dispersal and aggression facilitates the rapid range expansion of a passerine bird. Proc Natl Acad Sci 2007;104:15017-22. https://doi.org/10.1073/pnas.0706174104.

[20] Cote J, Fogarty S, Weinersmith K, Brodin T, Sih A. Personality traits and dispersal tendency in the invasive mosquito fish (Gambusia affinis). Proc R Soc B Biol Sci 2010;277:1571-9. https://doi.org/10.1098/rspb.2009.2128.

[21] Romero-Ferrero F, Bergomi MG, Hinz RC, Heras FJH, de Polavieja GG. idtracker.ai: tracking all individuals in small or large collectives of unmarked animals. Nat Methods 2019;16:179-82. https://doi.org/10.1038/s41592-018-0295-5.

[22] Walter T, Couzin ID. TRex, a fast multi-animal tracking system with markerless identification, and 2D estimation of posture and visual fields. Elife 2021;10: e64000. https://doi.org/10.7554/eLife.64000.

[23] Panadeiro V, Rodriguez A, Henry J, Wlodkowic D, Andersson M. A review of 28 free animal-tracking software applications: current features and limitations. Lab Anim 2021:1-9. https://doi.org/10.1038/s41684-021-00811-1.

[24] Core Team R. R: a language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing; 2020. https://www.R-project.org/.

[25] Turchin P. Quantitative analysis of movement: measuring and modeling population redistribution in animals and plants. Storrs, Connecticut: Beresta Books; 2015.

[26] Kareiva PM, Shigesada N. Analyzing insect movement as a correlated random walk. Oecologia 1983;56:234-8. https://doi.org/10.1007/BF00379695.

[27] Ester M, Kriegel H-P, Sander J, Xu X. A density-based algorithm for discovering clusters in large spatial databases with noise. In: Proceedings of the second international conference on knowledge discovery and data mining. Portland, Oregon: AAAI Press; 1996. p. 226-31.

[28] Noldus LPJJ, Spink AJ, Tegelenbosch RAJ. EthoVision: A versatile video tracking system for automation of behavioral experiments. Behav Res Methods Instrum Comput 2001;33:398-414. https://doi.org/10.3758/BF03195394.

[29] Chiara V, Kim S-Y. AnimalTA: A highly flexible and easy-to-use program for tracking and analysing animal movement in different environments. Methods Ecol Evol 2023;14:1699-707. https://doi.org/10.1111/2041-210X.14115.

[30] Rodriguez A, Zhang H, Klaminder J, Brodin T, Andersson PL, Andersson M. ToxTrac: A fast and robust software for tracking organisms. Methods Ecol Evol 2018;9:460-4. https://doi.org/10.1111/2041-210X.12874.

[31] B.M. Marshall, A.B. Duthie, abmAnimalMovement: An R package for simulating animal movement using an agent-based model, (2022). 10.12688/f1000research.124810.1. R package version 0.1.3.0000. https://github.com/BfEnMMarshall/abmAnimalMovement. [Accessed January 1, 2024].

[32] Signer J., Fieberg J., Avgar T. Animal movement tools (amt): R package for managing tracking data and conducting habitat selection analyses. Ecol Evol 2019; 9:880-890. doi:10.1002/ece3.4823. R package version 0.2.1.0. https://CRAN.R-project.org/package=amt. [Accessed January 1, 2024].

[33] B. Kranstauber, K. Safi, A.K. Scharf, move2: processing and analysing animal trajectories, (2024). https://bartk.gitlab.io/move2/. R package version 0.2.7. http://CRAN.R-project.org/package=move2. [Accessed January 1, 2024].

[34] Calenge C., Home Range Estimation. R package version 0.4.21 2023. https://CRAN.R-project.org/package=adehabitatHR. [Accessed 26 February 2024].

[35] C. Calenge, adehabitatLT: Analysis of Animal Movements, (2023). R package version 0.3.27. https://CRAN.R-project.org/package=adehabitatLT. [Accessed 26 February 2024].

[36] C. Calenge, adehabitatHS: Analysis of Habitat Selection by Animals, (2023). R package version 0.3.17. https://CRAN.R-project.org/package=adehabitatHS. [Accessed 26 February 2024].

[37] Jonsen I.D., Grecian W.J., Phillips L., Carroll G., McMahon C., Harcourt R.G., et al. aniMotum, an R package for animal movement data: Rapid quality control, behavioural estimation and simulation. Methods Ecol Evol 2023;14:806-816. doi:10.1111/2041-210X.14060. R package version 1.2-04. https://github.com/ianjonSen/aniMotum. [Accessed January 1, 2024].

[38] Michelot T., Langrock R., Patterson T.A. moveHMM: an R package for the statistical modelling of animal movement data using hidden Markov models. Methods Ecol Evol 2016;7:1308-1315. doi:10.1111/2041-210X.12578. R package version 1.9. https://CRAN.R-project.org/package=moveHMM. [Accessed January 1, 2024].

[39] McClintock B.T., Michelot T. momentuHMM: R package for generalized hidden Markov models of animal movement. Methods Ecol Evol 2018;9:1518-1530. doi:10.1111/2041-210X.12995. R package version 1.5.5. https://CRAN.R-project.org/package=momentuHMM. [Accessed January 1, 2024].

[40] Joo R, Boone ME, Clay TA, Patrick SC, Clusella-Trullas S, Basille M. Navigating through the r packages for movement. J Animal Ecol 2020;89:248-67. https://doi.org/10.1111/1365-2656.13116.

[41] S. Garnier, trackdf - A data frame class for tracking data, (2023). GitHub repository, https://github.com/swarm-lab/trackdf. R package version 0.3.2. [Accessed January 1, 2024].

[42] Lean D.J., Skowron Volponi M.A. trajr: An R package for characterisation of animal trajectories. Ethology 2018;124:440-448. doi:10.1111/eth.12739. R package version 1.5.1. https://CRAN.R-project.org/package=trajr. [Accessed February 26, 2024].
[43] M. Boone, R. Joo, M. Basille, sftrack: modern classes for tracking and movement data, (2023). https://mablab.org/sftrack/. R package version 0.5.4. https://CRAN.R-project.org/package=sftrack. [Accessed February 26, 2024].

[44] Wortel I.M.N., Liu A.Y., Dannenberg K., Berry J.C., Miller M.J., Textor J. CelltrackR: An R package for fast and flexible analysis of immune cell migration data. Immunoinformatics 2021;1-2:100003. doi:10.1016/j.immuno.2021.100003. (Amst). R package version 1.1.0. https://CRAN.R-project.org/package=celltrackR. [Accessed January 1, 2024].

[45] Wolkovich EM, Regetz J, O'Connor MI. Advances in global change research require open science by individual researchers. Glob Chang Biol 2012;18:2102-10. https://doi.org/10.1111/j.1365-2486.2012.02693.x.

[46] O'Dea RE, Parker TH, Chee YE, Culina A, Drobniak SM, Duncan DH, Fidler F, Gould E, Ihle M, Kelly CD, Lagisz M, Roche DG, Sánchez-Tójar A, Wilkinson DP, Wintle BC, Nakagawa S. Towards open, reliable, and transparent ecology and evolutionary biology. BMC Biol 2021;19:68. https://doi.org/10.1186/s12915-021-01006-3.

[47] Powers SM, Hampton SE. Open science, reproducibility, and transparency in ecology. Ecol Appl 2019;29:e01822. https://doi.org/10.1002/eap.1822.

[48] Lai J, Lortie CJ, Muenchen RA, Yang J, Ma K. Evaluating the popularity of R in ecology. Ecosphere 2019;10:e02567. https://doi.org/10.1002/ecs2.2567.

[49] Bates D, Maechler M, Bolker B, Walker S. Fitting linear mixed-effects models using lme4. J Stat Softw 2015;67(1):1-48. https://doi.org/10.18637/jss.v067.i01.

[50] Schneider CA, Rasband WS, Eliceiri KW. NIH Image to ImageJ: 25 years of image analysis. Nat Methods 2012;9:671-5. https://doi.org/10.1038/nmeth.2089.

[51] C. Hennig, fpc: flexible procedures for clustering, (2023). R package version 2.2-11. https://cran.r-project.org/web/packages/fpc/index.html. [Accessed June 2, 2023].

[52] Wickham H., Hesselberth J., Salmon M. pkgdown: make static HTML documentation for a package; 2022. R package version 2.0.7. https://CRAN.R-project.org/package=pkgdown. [Accessed June 2, 2023].

[53] Ion Scotta M, Margris L, Sellier N, Warot S, Gatti F, Siccardi F, Gibert P, Vercken E, Ris N. Genetic variability, population differentiation, and correlations for thermal tolerance indices in the minute wasp, Trichogramma cacoeciae. Insects 2021;12: 1013. https://doi.org/10.3390/insects12111013.

[54] Raffard A, Cucherousset J, Prunier JG, Loot G, Santoul F, Blanchet S. Variability of functional traits and their syndromes in a freshwater fish species (Phoxinus phoxinus): The role of adaptive and nonadaptive processes. Ecol Evol 2019;9: 2833-46. https://doi.org/10.1002/ece3.4961.

[55] Killen SS, Marras S, Metcalfe NB, McKenzie DJ, Domenici P. Environmental stressors alter relationships between physiology and behaviour. Trends Ecol Evol 2013;28:651-8. https://doi.org/10.1016/j.tree.2013.05.005.

[56] Réale D, Reader SM, Sol D, McDougall PT, Dingemanse NJ. Integrating animal temperament within ecology and evolution. Biol Rev 2007;82:291-318. https://doi.org/10.1111/j.1469-185X.2007.00010.x.

[57] Réale D, Garant D, Humphries MM, Bergeron P, Careau V, Montiglio PO. Personality and the emergence of the pace-of-life syndrome concept at the population level. Philos Trans R Soc B Biol Sci 2010;365:4051-63. https://doi.org/10.1098/rstb.2010.0208.

[58] Bernhardt ES, Rosi EJ, Gessner MO. Synthetic chemicals as agents of global change. Front Ecol Environ 2017;15:84-90. https://doi.org/10.1002/fee.1450.

[59] UNEP, Global chemicals outlook, Geneva, Switzerland: united nations environment programme. (2019). https://www.unep.org/explore-topics/chemicals-wast e/what-we-do/policy-and-governance/global-chemicals-outlook. [Accessed June 21, 2023].

[60] Brodin T, Piovano S, Fick J, Klaminder J, Heynen M, Jonsson M. Ecological effects of pharmaceuticals in aquatic systems—impacts through behavioural alterations. Philos Trans R Soc Lond B Biol Sci 2014;369. https://doi.org/10.1098/rstb.2013.0580.

[61] Metcalfe CD, Bayen S, Desrosiers M, Muñoz G, Sauvé S, Yargeau V. An introduction to the sources, fate, occurrence and effects of endocrine disrupting chemicals released into the environment. Environ Res 2022;207:112658. https://doi.org/10.1016/j.envres.2021.112658.

[62] Bundschuh M, Seitz F, Rosenfeldt RR, Schulz R. Effects of nanoparticles in fresh waters: risks, mechanisms and interactions. Freshw Biol 2016;61:2185-96. https://doi.org/10.1111/fwb.12701.

[63] Talbot R, Chang H. Microplastics in freshwater: A global review of factors affecting spatial and temporal variations. Environ Pollut 2022;292:118393. https://doi.org/10.1016/j.envpol.2021.118393.

[64] Ågerstrand M, Arnold K, Balshine S, Brodin T, Brooks BW, Maack G, McCallum ES, Pyle G, Saaristo M, Ford AT. Emerging investigator series: use of behavioural endpoints in the regulation of chemicals. Environ Sci Process Impact 2020;22: 49-65. https://doi.org/10.1039/C9EM00463G.

[65] Burte V, Cointe M, Perez G, Mailleret L, Calcagno V. When complex movement yields simple dispersal: behavioural heterogeneity, spatial spread and parasitism in groups of micro-wasps. Mov Ecol 2023;11:13. https://doi.org/10.1186/s40462-023-00371-8.