| Title: | Alpha, Beta and Gamma Proximity to Irreplaceability |
|---|---|
| Description: | Functions to measure Alpha, Beta and Gamma Proximity to Irreplaceability. The methods for Alpha and Beta irreplaceability were first described in: Baisero D., Schuster R. & Plumptre A.J. Redefining and Mapping Global Irreplaceability. Conservation Biology 2021;1-11. <doi:10.1111/cobi.13806>. |
| Authors: | Daniele Baisero [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-1266-7174>) |
| Maintainer: | Daniele Baisero <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.5 |
| Built: | 2026-05-25 08:08:43 UTC |
| Source: | https://github.com/cran/proxirr |
This function calculates Alpha irreplaceability. Inputs can be single
parameter values needed to calculate Alpha, vectors of parameter values to
calculate a vector of Alpha values, or a data.frame with columns
containing parameters needed to calculate a vector of Alpha values.
Single Alpha measurement: If local, global and
target are numeric, it calculates and returns Alpha irreplaceability.
Vectorized Alpha measurement: If local, global
and target are vectors of the same length, a vector of Alpha
irreplaceability values will be calculated and returned.
Dataframe Alpha measurement: If df is provided and
local, global and target are strings representing
field names in df, a vector of Alpha irreplaceability values will be
caluclated and returned. Optionally: If alpha_col is also
provided, a data.frame identical to df will be returned with
the calculated Alpha values in the alpha_col column.
alpha( local, global, target, df = NULL, alpha_col = NULL, triage = FALSE, na.allow = NULL, overwrite = FALSE )alpha( local, global, target, df = NULL, alpha_col = NULL, triage = FALSE, na.allow = NULL, overwrite = FALSE )
local |
number, vector or string - The feature's representation at the site, or the name of the column containing the feature's representation at the site. |
global |
number, vector or string - The feature's globally available representation, or the name of the column containing the feature's globally available representation. |
target |
number, vector or string - The feature's target, or the name of the column containing the feature's target. |
df |
data.frame - Optional; an input data.frame. |
alpha_col |
string - The name of the column where to write alpha values. If both df and alpha_col are provided, the output will be the input dataframe with the additional column. |
triage |
logical - Should features with unachievable targets be ignored?
Defaults to |
na.allow |
logical - Allaw |
overwrite |
logical - Should |
A number, vector or data.frame
Daniele Baisero, [email protected]
alpha(1, 100, 45) alpha(c(1,25,45), c(100,100,100), c(50,50,50)) dtfrm = data.frame( loc = c(1,25,45), glob = c(100,100,100), targ = c(50,50,50) ) alpha('loc', 'glob', 'targ', df = dtfrm)alpha(1, 100, 45) alpha(c(1,25,45), c(100,100,100), c(50,50,50)) dtfrm = data.frame( loc = c(1,25,45), glob = c(100,100,100), targ = c(50,50,50) ) alpha('loc', 'glob', 'targ', df = dtfrm)
This function calculates Beta irreplaceability. Inputs can be either a vector
of Alpha values, or a data.frame containing all necessary parameters
needed to calculate Alpha values on a row-by-row basis.
Vector Beta measurement: If data is a vector of Alpha
irreplaceability values, a single Beta value will be calculated and
returned.
Dataframe Beta measurement: If data is a
data.frame and local, global and target are
strings representing field names in data, a vector of Alpha
irreplaceability values will be caluclated using these fields, and a Beta
irreplaceability value will be calculated on these, and returned.
beta( data, local = NULL, global = NULL, target = NULL, triage = FALSE, na.rm = TRUE )beta( data, local = NULL, global = NULL, target = NULL, triage = FALSE, na.rm = TRUE )
data |
vector or data.frame - The input over which to calculate Beta. |
local |
string - The name of the column containing the feature's
representation at the site. Needed if data is a |
global |
string - The name of the column containing the feature's total
available representation. Needed if data is a |
target |
string - The name of the column containing the feature's target.
Needed if data is a |
triage |
logical - Should features with unachievable targets be ignored? Defaults to FALSE. If FALSE, these species will be always assigned an Alpha irreplaceability of 1 wherever they occur. If TRUE, these species will always be assigned an Alpha irreplaceabiltiy of 0. |
na.rm |
logical - Should lines with missing values (NA) be ignored? If
data is a |
A number
Daniele Baisero, [email protected]
beta(c(0.01, 0.5, 0.5)) dtfrm = data.frame( loc = c(1,25,45), glob = c(100,100,100), targ = c(50,50,50) ) beta(dtfrm, local = 'loc', global = 'glob', target = 'targ')beta(c(0.01, 0.5, 0.5)) dtfrm = data.frame( loc = c(1,25,45), glob = c(100,100,100), targ = c(50,50,50) ) beta(dtfrm, local = 'loc', global = 'glob', target = 'targ')
This function calculates Gamma of irreplaceability. Inputs can be either a
vector of Alpha values, or a data.frame containing all necessary
parameters needed to calculate Alpha values on a row-by-row basis.
Vector Gamma measurement: If data is a vector of
Alpha irreplaceability values, a single Gamma value will be calculated and
returned.
Dataframe Gamma measurement: If data is a
data.frame and local, global and target are
strings representing field names in data, a vector of Alpha
irreplaceability values will be caluclated using these fields, and a Gamma
if irreplaceability value will be calculated on these, and returned.
gamma( data, local = NULL, global = NULL, target = NULL, triage = FALSE, na.rm = TRUE )gamma( data, local = NULL, global = NULL, target = NULL, triage = FALSE, na.rm = TRUE )
data |
vector or data.frame - The input over which to calculate Gamma. |
local |
string - The name of the column containing the feature's
representation at the site. Needed if data is a |
global |
string - The name of the column containing the feature's total
available representation. Needed if data is a |
target |
string - The name of the column containing the feature's target.
Needed if data is a |
triage |
logical - Should features with unachievable targets be ignored? Defaults to FALSE. If FALSE, these species will be always assigned an Alpha irreplaceability of 1 wherever they occur. If TRUE, these species will always be assigned an Alpha irreplaceabiltiy of 0. |
na.rm |
logical - Should lines with missing values (NA) be ignored? If
data is a |
A number
Daniele Baisero, [email protected]
gamma(c(0.01, 0.5, 0.5)) dtfrm = data.frame( loc = c(1,25,45), glob = c(100,100,100), targ = c(50,50,50) ) gamma(dtfrm, local = 'loc', global = 'glob', target = 'targ')gamma(c(0.01, 0.5, 0.5)) dtfrm = data.frame( loc = c(1,25,45), glob = c(100,100,100), targ = c(50,50,50) ) gamma(dtfrm, local = 'loc', global = 'glob', target = 'targ')
Given a valid Marxan input.dat file, it returns a copy of the PUVSPRNAME file (puvspr.dat), with additional columns containing the feature's global value, target value, and alpha irreplaceability.
marxan_alphas(input, triage = FALSE)marxan_alphas(input, triage = FALSE)
input |
string - The address of the input.dat file. |
triage |
logical - Should features with unachievable targets be given an
irreplaceability of 0? See |
The global value is obtained as the sum of the feature's "amount" column in PUVSPRNAME.
The target value is obtained from the SPECNAME file (spec.dat), either as the proportion of the global value (if the "prop" column is present in SPECNAME), or as the "target" value in SPECNAME (otherwise). This behaviour mirrors Marxan's default behaviour.
A data.frame
Daniele Baisero, [email protected]
## Not run: marxan_alphas('/data/marxan/analysis01/input.dat') marxan_alphas('C:\data\marxan\analysis01\input.dat') ## End(Not run)## Not run: marxan_alphas('/data/marxan/analysis01/input.dat') marxan_alphas('C:\data\marxan\analysis01\input.dat') ## End(Not run)
Given a valid Marxan input.dat file, returns a copy of the PUNAME file (pu.dat), with an additional column containing the planning unit's beta irreplaceability.
marxan_betas(input, triage = FALSE)marxan_betas(input, triage = FALSE)
input |
string - The address of the input.dat file. |
triage |
logical - Should features with unachievable targets be given an
irreplaceability of 0? See |
A data.frame
Daniele Baisero, [email protected]
## Not run: marxan_betas('/data/marxan/analysis01/input.dat') marxan_betas('C:\data\marxan\analysis01\input.dat') ## End(Not run)## Not run: marxan_betas('/data/marxan/analysis01/input.dat') marxan_betas('C:\data\marxan\analysis01\input.dat') ## End(Not run)
Given a valid Marxan input.dat file, returns a copy of the PUNAME file (pu.dat), with an additional column containing the planning unit's gamma of irreplaceability.
marxan_gammas(input, triage = FALSE)marxan_gammas(input, triage = FALSE)
input |
string - The address of the input.dat file. |
triage |
logical - Should features with unachievable targets be given an
irreplaceability of 0? See |
A data.frame
Daniele Baisero, [email protected]
## Not run: marxan_gammas('/data/marxan/analysis01/input.dat') marxan_gammas('C:\data\marxan\analysis01\input.dat') ## End(Not run)## Not run: marxan_gammas('/data/marxan/analysis01/input.dat') marxan_gammas('C:\data\marxan\analysis01\input.dat') ## End(Not run)
Saves the outputs of marxan_alphas, marxan_betas,
and marxan_gammas in the marxan output folder.
marxan_run(input, alphas = TRUE, betas = TRUE, gammas = TRUE, triage = FALSE)marxan_run(input, alphas = TRUE, betas = TRUE, gammas = TRUE, triage = FALSE)
input |
string - The address of the input.dat file. |
alphas |
logical - Should the Alpha Irreplaceability output be saved? |
betas |
logical - Should the Beta Irreplaceability output be saved? |
gammas |
logical - Should the Gamma of Irreplaceability output be saved? |
triage |
logical - Should features with unachievable targets be given an
irreplaceability of 0? See |
Three files ('_proxirr_alphas.csv', '_proxirr_betas.csv', '_proxirr_gammas.csv') will be created prefixed with the scenario name indicated in 'input.dat' ('SCENNAME').
TRUE
Daniele Baisero, [email protected]
## Not run: marxan_run('/data/marxan/analysis01/input.dat') marxan_run('C:\data\marxan\analysis01\input.dat') ## End(Not run)## Not run: marxan_run('/data/marxan/analysis01/input.dat') marxan_run('C:\data\marxan\analysis01\input.dat') ## End(Not run)