This seems like A simple question but I'm not sure how to phrase it or ask. I want to bring in to r many rasters from many years and instead of typing them all out, I want to be able to define the year and bring in rasters by incorporating that defined year. This way I can copy and paste my code and instead of changing the year in every raster name, I can just change it once where I define the year.
Here is an example. I defined year as 2012 and in r.12 I tried using it to bring in the raster but this didn't work. r.1 is an example of how the rasters are all named.
year <- "2012"
r.12 <- raster("pr_total_mm_CRU_TS40_historical_12_"+year+".tif")
r.1 <- raster("pr_total_mm_CRU_TS40_historical_01_2012.tif")