Description Usage Arguments Details Value Author(s) Examples
Convert a real variable into a binary variable (i.e., 0 or 1) filtering by a threshold.
1 2 
x 
The input grid to be converted to binary. It can be an object or a matrix/array. 
condition 
Inequality operator to be applied considering the given threshold.

threshold 
An integer. Threshold used as reference for the condition. Default is NULL. 
partial 
A logic value. If TRUE, only values that do not accomplish the condition will turn to 0 and the others will remain with their original grid real value. For example, if condition = "GT" and threshold = 1 then every value lower than 1 will turn to 0. Default is FALSE. 
ref.obs 
Grid of observations. It is used to determine the number of days where there is no event (or value equal to 0). 
ref.pred 
Grid of predictions. It is used to calculate the threshold that will further be used to convert to binary the grid x. 
values 
A vector of length 2. For example, values = c(0,1), which is the DEFAULT. Then every sample satisfying the condition is equal to the second element of 'values' (i.e., in our example would be equal to 1), whereas if a sample does not satisfy the condition then takes the first element (i.e., in our example would be equal to 0). 
The function works for regular and irregular grids as downloaded from loadeR).
A new grid object with binary values
J. BanoMedina
1 2 3 4 5 6 7 8  # Take a look at the data:
head(VALUE_Iberia_pr$Data)
# Convert to complete binary variable:
ybin < binaryGrid(VALUE_Iberia_pr,threshold = 1)
head(ybin$Data)
# Convert to partial binary variable:
ybin2 < binaryGrid(VALUE_Iberia_pr,threshold = 1, partial = TRUE)
head(ybin2$Data)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.