How to efficiently bring in all raster files into R? -
How to efficiently bring in all raster files into R? -
i bringing in 10+ raster files (one-band files, not big) r folder outside of working directory. individually calling files works, it's getting tedious. have seen people utilize code similar this:
require(raster) current.list <- list.files(path="y:/spatial/rasterdata/current", pattern =".tif", full.names=true) c.stack<- stack(current.list)
however, raising various errors me. including, ".rasterobjectfromfile(x, band = band, objecttype = "rasterlayer", : cannot create rasterlayer object file. (file not exist)"
note, i've tried several different formats (.grd, .img) , require(rgdal) prior running command. in advance thoughts!
i haven't tested it, think if add together "$" sign end of pattern = ".tif" portion, i.e.:
current.list <- list.files(path="y:/spatial/rasterdata/current", pattern =".tif$", full.names=true)
...things should work. best of luck, , allow me know if doesn't you.
r r-raster
Comments
Post a Comment