Skip to content
birdflow-sciencePublic

About

BirdFlow R Package

Topics

Resources

Contributing

Stars

22 stars

Watchers

5 watching

Forks

Repository files navigation

BirdFlowR

R-CMD-check Codecov test coverage

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

  • vignette("BirdFlowR") has a longer introduction to the package, and how to use predict() and route() to project bird distributions and movement.
  • vignette("Installation") for detailed installation instructions.
  • vignette("Preprocess") covers downloading and formatting data for model fitting with preprocess_species(), importing fitted models with import_birdflow(), and reducing model size with sparsify().\
  • Read the paper:

About

BirdFlow R Package

Topics

Resources

Contributing

Stars

22 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages