Skip to contents

An R package to predict changes in bird distributions and generate synthetic migration routes based on BirdFlow models.

Installation

Install just the package:

# install.packages("pak")
pak::pak("birdflow-science/BirdFlowR")

Or install with example data and optional additional packages:

pak::pak("birdflow-science/BirdFlowR", dependencies = TRUE)

See the Installation vignette for more information and help troubleshooting.

Usage

The two primary functions are route() to generate synthetic routes, and predict() to project distributions.

route()

route() generates synthetic migration routes from user specified starting locations. If unspecified, locations are sampled from the initial species distribution.

library(BirdFlowR)
library(BirdFlowExamples) 

bf <- amewoo 
species(bf)
#> [1] "American Woodcock"

# Generate and plot routes for the prebreeding migration 
rts <- route(bf, n = 10, season = "prebreeding")
plot_routes(rts, bf)

predict()

predict() propagates an input distribution forward or backward in time. In this example we predict where birds from a randomly selected location in the winter will be in the summer.

set.seed(1)
initial_distribution <- get_distr(bf, 1)
location <- sample_distr(initial_distribution)
forecast <- predict(bf, distr = location, start = 1, end = 26, direction = "forward")
plot_distr(forecast[, c(1, 7, 14, 19)], bf, dynamic_scale = TRUE)

Learn more