# NOT RUN {
rast <- raster::raster(matrix(1:100, ncol=10), xmn=0, ymn=0, xmx=10, ymx=10)
poly <- sf::st_as_sfc('POLYGON ((2 2, 7 6, 4 9, 2 2))')
cov_frac <- coverage_fraction(rast, poly)[[1]]
# }
Run the code above in your browser using DataCamp Workspace