Omitting the first raster comes from my example, where I need a first raster to start stacking.

Using Oscar's approach, you could simply do:

rst <- list.files(pattern='*.rst')
s <- stack(rst)



________________________________
 From: Oscar Perpiñán Lamigueiro <oscar.perpinan@gmail.com>
To: Nora Schmid <noerchen306@gmail.com> 

-sig-geo@r-project.org> 
Sent: Wednesday, 18 April 2012, 4:55
Subject: Re: create a TS with multiple raster files



> Dear Nora,
>
> The best thing would be to read the vignette of the raster package first.
>
> A combination of raster layers is not a data frame, but a stack.
>
> This is how you make one, following your example:
>
>
> st <- get(list.files(pattern='*.rst')[1])
>
> for (f in list.files(pattern='*.rst')[-1]) {st <- stack(st, get(f))}
>
Another approach is to pass the result of list.files directly to stack
(if I am not wrong you do not want the first file to be included, that's
why I use [-1]):

library(raster)

rst <- list.files(pattern='*.rst')
s <- stack(rst[-1])

If this stack is a space-time data you can use the setZ function. If idx
is the time index of the data:

s <- setZ(s, idx)

Best,

Oscar.
>
>
> ________________________________
>  From: Nora Schmid <noerchen306@gmail.com>
> To: r-sig-geo@r-project.org 
> Sent: Tuesday, 17 April 2012, 9:25
> Subject: [R-sig-Geo] create a TS with multiple raster files
>
> Hello,
>
> Im new in R and dont have lots of experiences with programming...
> Im trying to create a time series:
> I read my raster data with the following:
>
> for (f in list.files(pattern='*.rst')){assign(f, raster(f))}
>
> How can I create afterwards a time series with the files I loaded? How
> can I assign all files to one data frame? Whats the best way to create
> from multiple raster files on time series?
>
> Thanks a lot in advance,
>
> yours
>
> Nora
>
>   [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>     [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-- 
Oscar Perpiñán Lamigueiro
Dpto. Ingeniería Eléctrica
EUITI-UPM
URL: http://procomun.wordpress.com
Twitter: @oscarperpinan
	[[alternative HTML version deleted]]

