Learn R Programming

zonator

zonator is a utility R package for dealing with various tasks related to Zonation conservation prioritization software. The package started out as a collection of helper scripts which have now been packaged for anybody interested in using a familiar tool (R) in setting up Zonation runs and managing Zonation results.

Functions and classes found in zonator can be useful for the following stages of running a Zonation analysis.

  1. Setting up a Zonation project and pre-processing files (examples).
  2. Running Zonation.
  3. Post-processing, results analysis and comparison, and plotting (examples).

Installation

Release version

NOTE: As of 2019-03-15 zonator isn't on CRAN. Hopefully it will get back there soon, but in the meantime you can install it directly from Github:

You can install the latest release version from CRAN:

install.packages("remotes")
remotes::install_github("cbig/zonator")

Development version

Alternatively, you can install the latest (potentially unstable) development version from Github.

  1. Make sure you have package remotes installed and loaded in R:
# Open R prompt or RStudio and type the following on the command line
install.packages("remotes")
  1. Then install zonator directly from GitHub by running the following line in R:
remotes::install_github("cbig/zonator", ref = "develop", build_vignettes = TRUE)

Examples

Some examples are provided by the package vignettes. You can view these after installing the package by:

vignette("zonator-project")

and

vignette("zonator-results")

Developers

Copy Link

Version

Install

install.packages('zonator')

Monthly Downloads

29

Version

0.6.0

License

FreeBSD

Maintainer

Joona Lehtomaki

Last Published

May 18th, 2020

Functions in zonator (0.6.0)

features_info

Get the features info component of Zresults.
file_path_relative_to

Transform an absolute path to relative path in relation to given location
copy_zvariant

Copy existing variant as a new Zvariant object.
correlation

Correlation between two matrices.
Zproject

The Zproject class
create_zproject

Create a new Zonation project on file system.
names,Zproject-method

Names of variants in Zproject
check_names

A function check feature/group names.
nfeatures

Get the number of feature included in a Zonation variant
clean_str

Clean leading and trailing whitespaces from a given string. Additionally, all occurrences of multiple whitespaces are replaced with a single whitespace.
cross_jaccard

Calculate Jaccard coefficients bewteen all the RasterLayers within a single RasterStack.
Zresults

The Zresults class
rank_raster

Get Zonation result rank raster.
create_spp

Generate spp_file based on a directory of input rasters.
print,Zvariant-method

Print Zvariant information.
check_variant

Check zvariant object's attributes for consistency.
get_tutorialdir

Get the directory of Zonation tutorial.
cost

Get cost data of a Z* object.
get_variant

Get a specified variant in a Zonation project
nvariants

Get the number of variants included in a Zonation project
check_zonation

Check if Zonation is installed.
comp

Compare matrices in various ways.
file_path_sans_ext

Re-implementation of file_path_sans_ext in tools. This version can handle "." just before the file extenstion, unlike the original implementation.
get_dat_param

Get a specified run setting parameter value
leaf_tags

Find all the leaf tags in a potentially nested list. The generic form of a list is tag = value; find all the tags in a list.
plot,ZGroupCurvesDataFrame,missing-method

Plot Zonation performance curves for groups.
opendir

Open the directory of a Zproject using the system file browser.
read_ppa_lsm

Read Zonation post-processing analysis (ppa) result file.
jaccard

Calculate the Jaccard coefficient.
save_zvariant

Saves the current state of an instance of Zvariant-class on the file system. Zvariant object tracks the location of relevant files, but the root path can be changed. If it is not changed, then the current files can be overwritten.
plot_curves

Create ggplot2 object for performance curves.
read_grp_curves

Read in performance curves for grouped features produced by Zonation.
performance

Get performance levels.
groups

Get group codes of a class Zvariant instance.
load_zproject

Load a Zonation project.
groupnames

Get group names for a class Zvariant instance.
has_results

Check which results a Z* object has.
plot_hist

Create a ggplot2 histogram of a RasterLayer.
plot,ZCurvesDataFrame,missing-method

Plot Zonation performance curves for individual features.
map_indexes

Map vector to actual column indexes.
rank_rasters

Get Zonation result rank rasters of a project.
initialize,Zproject-method

Create an instance of the Zproject class using new/initialize.
decimalplaces

Find out the number of decimal places in a number.
results

Getter method for results (Zresults) in a class Zvariant object.
run_bat

Try to run a given batch (bat) files.
ds_alpha

Calculate alpha value for distribution smoothing.
selection_coverage

Intersection of two coverages.
read_curves

Read in performance curves produced by Zonation.
ppa_lsm

Get ppa.lsm results data of a Z* object.
read_dat

Read a dat file (Windows-style ini-file) for configuration information.
sub_curves

Get subset of curves/group curves columns.
zlegend

Get various Zonation legends
read_bat

Read Zonation-specific (MS Windows) batch file.
zparameters

Get all Zonation run configuration parameters.
read_groups

Read a groups file.
read_features_info

Read a features info file.
featurenames

Feature names of Zonation variant.
set_dat_param

Set a specified run setting parameter value
unique_grp_names

Get unique group names.
outdir

Get path to output directory.
show,Zvariant-method

Print Zvariant information.
curves

Get curves results data of a Z* object.
sppdata

Simple getter mehtod for spp data in a class Zvariantobject.
sppweights

Get biodiversity feature weights of a Zonation variant
parse_bat

Parse the content of a Zonation batch (bat) file and make OS specific adjustments if needed.
read_result_rasters

Read Zonation-specific raster result files.
read_spp

Read Zonation variant specific spp-file.
regroup_curves

Re-calculate group curves data.
require_package

Requires a given package and if not present installs and loads it.
variants

Get all variants in a Zonation project
write_dat

Write a Zonation run configuration (dat) file.
ZGroupCurvesDataFrame

The ZGroupCurvesDataFrame class
check_path

A function to deal with potentially relative paths.
ZCurvesDataFrame

The ZCurvesDataFrame class
Zvariant

The Zvariant class
check_results

Check zvariant object's attributes for consistency.