New answers tagged

0

It is just a matter of writing a function that returns the proportions and using lapply to apply it to the list returned from exact_extract. Add libraries and create example data library(sf) library(raster) library(exactextractr) nc <- st_read(system.file("shape/nc.shp", package="sf")) nc <- st_cast(nc, "POLYGON") r &...


0

Figured it out. First, reclassify raster making agricultural values 1 and everything else 0: agri_land_use_ras <- raster::reclassify(lu_raster, lu_matrix) See here for how to set up a reclassification matrix. Then, can just take the mean of the resulting raster: Results <- exact_extract(agri_land_use_ras, counties, 'mean')


Top 50 recent answers are included