R/bm_BinaryTransformation.R
bm_BinaryTransformation.RdThis internal biomod2 function allows to convert probability (not necessary
between 0 and 1) values into binary presence-absence (0 or 1) values
according to a predefined threshold (see Details).
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
# S4 method for class 'data.frame'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
# S4 method for class 'matrix'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
# S4 method for class 'numeric'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)
# S4 method for class 'SpatRaster'
bm_BinaryTransformation(data, threshold, do.filtering = FALSE)a vector, a matrix, data.frame, or a
SpatRaster containing the data to be converted
a numeric or a vector of numeric corresponding to
the threshold used to convert the given data (see Details)
(optional, default FALSE)
A logical value defining whether filtered data should be returned, or binary one
(see Details)
An object of the same class than data and containing either
binary (0 or 1) values, or filtered values.
If data is a vector, threshold should be a single
numeric value.
If data is a matrix, data.frame or
SpatRaster, threshold should be a
vector containing as many values as the number of columns or
layers contained in data. If only one numeric value is given,
the same threshold will be applied to all columns or layers.
If do.filtering = FALSE, binary (0 or 1) values are returned.
If do.filtering = TRUE, values will be filtered according to threshold,
meaning that :
data < threshold will return 0
data >= threshold will return the actual values of data (not
transformed in 1)
BIOMOD_Projection, BIOMOD_EnsembleForecasting
Other Secondary functions:
bm_CrossValidation(),
bm_FindOptimStat(),
bm_MakeFormula(),
bm_ModelingOptions(),
bm_PlotEvalBoxplot(),
bm_PlotEvalMean(),
bm_PlotRangeSize(),
bm_PlotResponseCurves(),
bm_PlotVarImpBoxplot(),
bm_PseudoAbsences(),
bm_RangeSize(),
bm_RunModelsLoop(),
bm_SRE(),
bm_SampleBinaryVector(),
bm_SampleFactorLevels(),
bm_Tuning(),
bm_VariablesImportance()
## Generate a 0-1000 vector (normal distribution)
vec.d <- rnorm(100, 500, 100)
## From continuous to binary / filtered vector
vec.d_bin <- bm_BinaryTransformation(data = vec.d, threshold = 500)
vec.d_filt <- bm_BinaryTransformation(data = vec.d, threshold = 500, do.filtering = TRUE)
cbind(vec.d, vec.d_bin, vec.d_filt)