I have two rasters:
raster1
class : RasterLayer
dimensions : 2803, 5303, 14864309 (nrow, ncol, ncell)
resolution : 0.008333333, 0.008333333 (x, y)
extent : 60.85, 105.0417, 15.95833, 39.31667 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
source : memory
names : npp
values : -0.345, 1.723 (min, max)
raster2
class : RasterLayer
dimensions : 2803, 5303, 14864309 (nrow, ncol, ncell)
resolution : 0.008333333, 0.008333333 (x, y)
extent : 60.85, 105.0417, 15.95833, 39.31667 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
source : C:/a/b/Documents/c/landuse.tif
names : landuse
values : 1, 12 (min, max)
attributes :
ID zn
from: 1 evergreen needleleaf forest
to : 12 croplands
raster2 is a land cover types of a specific region and raster1 is values of net primary productivity. I would like to compute how much net primary productivity is in each land cover class in raster 2. How could I achieve this in R?