Install animovement

Install the animovement ecosystem in R or with Pixi, load it, and add the optional packages.

Install the ecosystem

Installing the animovement metapackage pulls in the whole ecosystem. There are two ways to get it: from R itself, or as conda packages with Pixi.

animovement is distributed through our r-universe:

install.packages(
  "animovement",
  repos = c(
    "https://animovement.r-universe.dev",
    "https://cloud.r-project.org"
  )
)
1
The second repository (CRAN) is there so that dependencies which don’t live on r-universe are found too. Once the metapackage is installed you can get that repository pair back at any time with animovement_repos(), which is what the other install helpers use by default.

Every package is also published as a conda package, on the animovement channel on prefix.dev. With Pixi, create a project that uses that channel alongside conda-forge, add the metapackage, and start R inside it:

pixi init my-analysis \
  --channel https://prefix.dev/animovement \
  --channel conda-forge \
  --channel bioconda
cd my-analysis
pixi add r-animovement bioconductor-rhdf5
pixi run R

The project pins R and every package version in its lockfile, so the same analysis installs identically on another machine. The conda packages are built from the same commits as r-universe; pixi update brings them up to date.

bioconductor-rhdf5, from the bioconda channel, is the optional package the SLEAP and DeepLabCut HDF5 readers need (see below). In a Pixi project, add optional packages like this, with pixi add, rather than from inside R.

WarningAlready have R installed?

R also looks in your personal package library, and it looks there first. If that library holds packages built for the same R version, the project’s R can load those instead of its own and crash. To keep the project to its own packages, add this to pixi.toml:

[activation.env]
R_LIBS_USER = "$CONDA_PREFIX/lib/R/library"
TipOnly need one piece?

Every package installs the same way. Swap "animovement" for the package you want, such as "aniread", or with Pixi add r-aniread. See Packages for what each one does.

Load it

Like the tidyverse, library(animovement) attaches the core packages in one call and tells you what you got:

library(animovement)
#> -- Attaching packages -------------------------------- animovement 0.8.0.9002 --
#> v anicore    0.8.0.9005     v anicheck   0.3.0.9004
#> v aniread    0.7.0.9004     v animetric  0.5.0.9005
#> v anispace   0.3.0.9006     v anivis     0.2.1.9003
#> v aniprocess 0.5.0.9003

That’s the metapackage plus the 7 working packages, one per stage of the workflow:

animovement_packages()
#> [1] "anicore"     "aniread"     "anispace"    "aniprocess"  "anicheck"   
#> [6] "animetric"   "anivis"      "animovement"

From here on, the guides assume you’ve run library(animovement).

Optional packages

Some functions need a package that isn’t installed by default, such as arrow for Parquet files or rhdf5 for HDF5 exports. To see which:

animovement_show_suggested()
#> -- Suggested packages for animovement ecosystem --------------------------------
#> aniread: arrow, rhdf5, jsonlite, yaml, xml2, c3dr
#> aniprocess: signal, stinepack
#> animetric: sf

You don’t have to install these up front. When a function needs one, it says so and offers to install it there and then:

read_dataset(get_sample_data("sleap"))
#> Downloading sleap data...
#> ℹ The package "rhdf5" is required for reading HDF5 files,
#> ✖ Would you like to install it?
#>
#> 1: Yes
#> 2: No

Answer 1 and it installs and carries on with what you asked for, without restarting or re-running anything. To get them all in one go instead:

animovement_install_suggested()
NoteHDF5 exports need rhdf5

The sample used in these guides is a SLEAP HDF5 file, so rhdf5 is the optional package you’re most likely to meet first. It comes from Bioconductor rather than CRAN, so install.packages("rhdf5") won’t find it. Use the prompt above or animovement_install_suggested(), or with Pixi, pixi add bioconductor-rhdf5.

Update packages

The ecosystem is under active development. To update every animovement package at once:

animovement_update()

In a Pixi project, run pixi update instead.