> And I am sure someone can do this even shorter...

fls = list.files('foldername')
s <- stack(fls)

Robert

On Tue, Dec 13, 2011 at 5:24 AM, <jon.skoien@jrc.ec.europa.eu> wrote:

> Hi Sajid,
>
> You should be able to do something like this:
>
> setwd( name of folder)
> fls = list.files() # you can add a pattern if you only want files of a
> certain type
> dst = stack(fls[1])
> for (ifile in 2:length(fls)) dst = addLayer(dst, raster(fls[ifile]))
>
> And I am sure someone can do this even shorter...
>

> Cheers,
> Jon
>
>
> On 13-Dec-11 12:03, sajid pareeth wrote:
>
>> Hi
>>
>> I have number of raster files(more than 100) in a folder for which I want
>> to do some zonal stats.
>>
>> My question is how to add these raster files into R environment. Is there
>> any way to do that together? Like batch files, where we give the folder
>> and
>> all the files from that folder will be processed automatically.
>>
>> I want to make a stack of these rasters and do the processing.
>>
>> So instead of typing each file names in Stack (r1,r2,r3....) , I want to
>> call them automatically from a folder.
>>
>> Any idea in this direction???
>>
>> Thanks and Regards
>>
>>
>>
>
> --
> Jon Olav Skøien
> Joint Research Centre - European Commission
> Institute for Environment and Sustainability (IES)
> Global Environment Monitoring Unit
>
> Via Fermi 2749, TP 440,  I-21027 Ispra (VA), ITALY
>
> jon.skoien@jrc.ec.europa.eu
> Tel:  +39 0332 789206
>
> Disclaimer: Views expressed in this email are those of the individual and
> do not necessarily represent official views of the European Commission.
>
>
> ______________________________**_________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>

	[[alternative HTML version deleted]]

