How to efficiently bring in all raster files into R? -


I'm bringing 10+ raster files (one-band files, not too large) in the executive directory. Call different files, but it is getting tough I have seen that people use such code:

  is required (raster) current.list & lt ; - list.files (path = "wi: / local / rasterdata / current", pattern = ".tif", full.names = TRUE) c.stack & lt; - stack (current.list)   

However, this is adding different errors for me, " .rasterObjectFromFile (x, band = band, objecttype =" RasterLayer " ,): Can not create RasterLayer object from this file. (File does not exist) "

Note, I have tried many different formats (.grd, .img) and often command You need (RGDL) even before you run. Thanks in advance for your thoughts!

I have not tested it, but I think that if you change your pattern = ".tif" Add a "$" sign at the end of the section, i.e.:

  current.list & lt; - list.files (path = "wi: / spatial / rasterdata / current", pattern = ".tif $", complete.name = TRUE)   

... things work needed. The "$" symbol essentially means the end of the string, so you do not have anything except the list of files ending in ".tif" and (like "TIF.XML").

Good luck, and let me know that this does not do for you.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -