Thanks Greg,

This will get all my img
img <- list.files(pattern='\\.img$')

Could anybody kindly help me with sub function to change the input file
name and the output file name?





On Mon, Sep 16, 2013 at 6:09 PM, Greg Snow <538...@gmail.com> wrote:

> 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 <eddie...@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.
> 538...@gmail.com
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to