I've been trying to rasterize a list of shp imported in R. There is an error when I call the list because it is not recognize as dataframe but as a character. I've tryed to use as.dataframe(list[i]) without success.
Error: Unable to find an inherited method for function ‘rasterize’ for signature ‘"character", "RasterLayer"’
## import Shp
shp_ELC <- readOGR("EconomicLandConsesions/ELC.shp")
shp_CF <- readOGR("Communityforestry/Community_forestryPolygon.shp")
shp_NPA <- readOGR("Natural-Protected-Areas/Natural Protected Areas.shp")
shp_Ecoregion <- readOGR("TerrestrialEcoRegionsWWF/KH_TerrEcoregions_Dslv.shp")
## create Raster template
utm <- proj4string(shp_CF)
my_proj <- spTransform(shp_Ecoregion,utm)
my_ext <- extent(my_proj)
my_res <- 30
tempR <- raster(resolution = my_res, ext = my_ext, crs = my_proj)
## list SHP
listShp <- ls(pattern = glob2rx("*.df"))
## looping list
for(i in 1:length(listShp)){
rst_CF <- rasterize(data.frame(listShp[i]),tempR)
}