I have created a list of rasters - "norm" and run a several loops. Now I would like to write every created raster from "norm" (containing 1 layer) into one raster, having its specific name.
# I can get the rasters names
rst.names<-c(1:length(norm))
for(i in 1:length(norm)){
rst.names1<-names(norm[[i]])
rst.names[[i]]<-rst.names1
}
To write and save a rasters I have found a very useful answer on https://stackoverflow.com/questions/14890369/how-to-write-rasters-after-stacking-them
where they use to respond my question (modified):
unst_norm<- unstack(norm)
for(i in 1:lenght(unst_norm)){writeRaster(unst_norm[[i]], file=rst.names[i])}
However if I use "unstack" I have this error:
Error in stats::as.formula(form) :
argument "form" is missing, with no default
and I can´t find any help for that.
I can use "unlist" instead of "unstack" but it doesn't seem to work...
but I still get an error:
Error in .local(.Object, ...) : Unable to create dataset
Please, any ideas where the problem could be? Or, how to automatically write and save all rasters from raster list?