Passer au contenu

In this chapter we’ll install Motus R packages as well as other packages we’ll be using throughout these chapters.

Installing Motus R packages

Two R packages have been developed for Motus users:

  1. motus: provides functions for downloading and updating detection and deployment data, as well as for creating summary plots, and transforming (e.g. adding sunrise/sunset times) and analyzing Motus data.

  2. motusData: provides sample datasets used in some of these articles

Motus users can install the latest stable versions of the R packages using install.packages() (see below). As with all R packages, you only need to install the packages once; after installation, you need to load each package (using library()) each time you open a new R session.

To avoid errors, please ensure you are using the most recent releases of R and RStudio.

First update existing packages with the remotes package (this may take a while).


Next, we’ll start installing the required packages, if not already installed.

If you have used the older version of motus which included use of the motusClient package, it is recommended to first uninstall both packages.

remove.packages(c("motus", "motusClient"))

Then proceed with the installation/update of the motus and motusData packages.

install.packages(c("motus", "motusData"), 
                 repos = c(birdscanada = '',
                           CRAN = ''))

# Load the packages for use

If you want to know what version of the motus package you currently have installed:

If you are running into difficulties installing the motus package, please refer to the troubleshooting section for tips.

Installing other packages

Throughout these articles and examples, we use the tidyverse collection of R packages for data science, including tidyr, dplyr, ggplot2, and lubridate (for managing and manipulating dates). See the tidyverse website for more information, or browse (or better still, thoroughly read) R for Data Science by Garrett Grolemund and Hadley Wickham. For mapping we also use the rnaturalearth, and ggmap packages.

These can be installed from CRAN, as follows:

install.packages(c("tidyverse", "ggmap", "rnaturalearth"))

We also need a couple of data packages for rnaturalearth which can be installed from the rOpenSci R-universe:

install.packages(c("rnaturalearthhires", "rnaturalearthdata"),
                 repos = c(ropensci = '',  
                           CRAN = ''))

Now, to use these packages include the following in your scripts:

Internal data processing

As an animal moves within the detection range of a Motus station, radio transmissions, or ‘bursts’, are detected by antenna(s) and recorded by a receiver. These raw detection data are either uploaded to the Motus database instantaneously via internet connection, or downloaded periodically from the receiver and uploaded to Motus manually. Behind the scenes, various functions read and process the raw detections data to produce the tag detections file that users access using the R package (see Chapter 3 - Accessing Data). While most users will not need to call on the internal data processing functions, a complete list of functions within the Motus server R package can be found on the GitHub motusServer repository.

Next Chapter 3 - Accessing detections data (Explore all articles)