I have a Landsat image with 11 bands. I need to run k means classification in R. But I do not need the whole of the image as my study area is much smaller. So I have created shapefile of the Region of Interest (ROI) in ArcGIS which specifically covers my study area.
How does one clip a raster image to the extent of a shapefile (here my ROI) in R?