Edward Lavender*
*This repository is maintained by Edward Lavender (edward.lavender@eawag.ch).
This repository contains methods, written in
R and organised as an
RStudio
Project, for Lavender
et al. (in prep). patter
: particle algorithms for animal tracking in
R
and Julia
. In this project, we simulate animal tracking data and
apply particle filtering and smoothing algorithms to reconstruct
patterns of space use. The code forms a basic worked example of the
patter
R
package.
The project was built in R (version 4.3.1)
in RStudio and implements local dependency
management using
renv
. This
manages the installation of the
dv
package (from
GitHub), as well as other packages from the
Comprehensive R Archive Network. The
first time the project is opened,
renv
can be used
to regenerate the local project library, as described in renv.lock
(via .Rprofile
and renv/activate.R
).
The project follows a standardised structure encouraged by the
dv
package. The high-level
structure was generated via dv::use_template_proj()
. The contents as
follows:
-
renv/
implements local dependency management. -
data/
contains data:spatial/
contains spatial datasets (sourced frompatter-flapper
);data.table/
,filter/
,smoother/
,sim/
andud/
contain script outputs;inst/
contains RStudio Project-management files generated bydv
:dependencies.rds
is a list of dependencies;session-info.rds
is a record of information about theR
Session;tree.rds
is a record of the project directory tree (as generated bydv::use_template_tree()
indev/01-dev.R
, see below);
-
R/
contains scripts for data preparation, simulation and analysis:preparation.R
prepares spatial dataset(s);workflow.R
simulates and analyses animal tracking datasets;figs.R
produces manuscript figures;
-
src/
contains helper (R
) functions. -
Julia/
contains aJulia
project.- This is set up by
patter
;
- This is set up by
-
dev/
contains project-management scripts.01-dev.R
and02-clone.R
are standarddv
scripts:01-dev.R
records project set up and development;02-clone.R
is used to clone the project (see ‘Instructions’);
-
fig/
contains figures. -
doc/
contains supporting documents.
Note that the data/
(except data/inst/
), fig/
and doc
directories are not provided in the online version of this repository.
Follow the steps described below to clone the project and reproduce the workflow.
-
Clone the project via GitHub. Follow the instructions in
dev/02-clone.R
to install packages and directories: -
Source (raw) data via the links provided (or the authors).
-
Implement workflow via
R
scripts.
Lavender et al. (in prep). patter
: particle algorithms for animal
tracking in R
and Julia.
Please note that this project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.