for loop to automate processing

**Hi everyone ! **
I have this code (clip a raster along an extent) and i would like to add a for loop to automate the processing.
How can i do it please? Thank you

library(rgdal)
library(raster)

emprise <- readOGR('G:/BD/Emprise', 'Emprise')
a <- raster('G:/TC/2017/12/29.tif')
projection(emprise)
crs(emprise)

extent(emprise)

aemprise <- crop(a, extent(emprise))

aemprise2 <- mask(aemprise, emprise)
plot(aemprise2)
plot(emprise, add = TRUE)

writeRaster(aemprise2, 'G:/TC/2017/12/12_clip/12_29', format='GTiff')

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.