Use the list.files function to get a list of your file names, save that in
a variable, then use lapply or a loop to run your above code for each
filename.  The sub function is one option for changing the input filename
to the output filename.


On Mon, Sep 16, 2013 at 11:06 AM, Eddie Smith <eddieatr@gmail.com> wrote:

> Dear list,
>
> I can manually write a raster file(*.img) format to *.rst using this code:
> library(raster)
> myraster <- raster("1982001.img")
> rstraster <- writeRaster(myraster, filename="1982001.rst", format="IDRISI",
> overwrite=TRUE)
>
> I have bunch of img files located in one folder. How could I convert all
> those files to rst in one go?
>
> Thanks in advance
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Gregory (Greg) L. Snow Ph.D.
538280@gmail.com

	[[alternative HTML version deleted]]

