I'm trying to assign values to a number of raster files in a folder, and apply the raster() function to them, with the eventual aim to plot, stack, and subject algebra to them. So each raster file in the folder would be assigned to "r1", "r2" etc. So far I have:

f <- list.files(path="path/to/files", pattern="*.tif", full.names=TRUE, recursive=FALSE)
r <- lapply(f, raster)
lapply(r, function(i){
  assign(paste0("r", i), i)


> r1
[1] 1