Fastest way to mask raster using points
问题 I have a very large rasterbrick and some coordinates held in a different object. I wish to use the points as a mask, returning NA for all cells except where my points are located (for my particular application I need to preserve the extent, resolution and origin of the input rasterbrick ). I can accomplish this with the following: library(raster) library(tidyverse) library(sf) # Load a rasterbrick b <- brick(system.file("external/rlogo.grd", package="raster")) # Create some random points as