I have two rasters, one with land use data (raster A) classified in discrete values that represent different classes (1,2,3,4,5...18). The other one (raster B) contains data that can represent precipitation, temperature, humidity, etc. In both rasters, each pixel has a different value.
Both rasters have the same coordinate system and resolution, although the extent varies. The first raster covers only a patch of the second raster.
I want to intercept both rasters, and where a certain class from raster A with a certain value from raster B intercept, it multiply raster B times a constant value that depends on A. I have these constant values in a CSV file.
For example, if raster A land-use category==7 intercepts raster B where the value of B is equal to 50, then multiply 50 times 0.15. Another example would be, where
raster A == 1
raster B < 50
then
raster C == raster B * 0.46
but, wherever
raster A == 1
raster B > 50 & raster B < 150
raster C == raster B * 0.30
Important to mention is that for the same land-use class, different default values exist that depend on the value range from raster B (as shown in the second part above).
The question is, how can implement such conditional operations in R? I have tried multiplying raster A so values are scaled up (x100) and I can freely manipulate the resulting merge, without a success.