The n2khab R package provides preprocessing functions and standard reference data, supporting reproducible and transparent analyses on Flemish Natura 2000 (n2k) habitats (hab) and regionally important biotopes (RIBs).

The package’s core aim is to provide readily standardized (preprocessed) data in your R environment. This facilitates collaboration and reproducibility.

The standard reference data include: checklists, spatial habitat distribution, administrative & environmental layers, GRTSmaster_habitats.

Installing and using the n2khab package

To install the current package version from the main branch (latest stable release), run:

install.packages("n2khab", repos = c(inbo = "https://inbo.r-universe.dev", 
                                     CRAN = "https://cloud.r-project.org"))

The above provides a pre-compiled package for Windows and macOS, which should be faster than below approach. INBO staff should have the INBO repository enabled already (check with getOption("repos")), in which case install.packages("n2khab") is all you need!

If you want to install from the source repository, run:

Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS = "true") # as a precaution
                        build_vignettes = TRUE,
                        upgrade = TRUE)

Note that this will install the package from the main branch. If you need a version from another branch, add the ref argument in the above function to provide the branch name.

Repeat the installation when you wish to upgrade.

Have a look at the vignettes to quickly find your way!

help(package = "n2khab")
# vignettes only: browseVignettes("n2khab")
# documentation of whole package: package?n2khab

Data setup

Please take note that you must set up the needed data sources as explained in vignette("v020_datastorage") and demonstrated in vignette("v022_example"). There is a major distinction between:

  • raw data (Zenodo-link), to be stored in a folder n2khab_data/10_raw;
  • processed data (Zenodo-link), to be stored in a folder n2khab_data/20_processed.

You are welcome to contribute!

Please have a look at our contributing guide!

Intention for the future

At a later date, the intention is to incorporate functionality to enhance workflow reproducibility and ease the setup:

  • let a user declare which versions of which data sources are used in an R workflow (at the beginning of a script or R markdown file);
  • perform checks whether the needed versions of those data sources are locally present;
  • if missing, download the needed data from the Zenodo collections.

Currently these aspects must be taken care of in a more manual fashion. See vignette("v022_example") for example code to currently accomplish specific aspects.

Code of Conduct

Please note that the n2khab package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.