Skip to contents

This function is designed to behave similar to the ESRI Spatial Analyst Con function. The purpose of this function is to provide R with a raster safe ifelse function.

Usage

ifelse(condition, true_value, false_value)

Arguments

condition

raster or numeric; an expression that results in a boolean, matching the type of the condition.

true_value

raster, constant; Input true raster or constant value.

false_value

raster, constant; Input false raster or constant value.

Value

the true or false value matching the data type of the condition.

Details

This function was proposed by Spacedman on gis.stackexchange way back in 2013, What is the equivalent of arcpy "Con" in QGIS and/or R raster-package?