[R-sig-Geo] How to compute an average year on time series ?

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Jul 25 19:37:14 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

spacetime does not provide this, but zoo does; see the last example in
?aggregate.zoo. I'd try something along these lines:

pix = obj at sp
obj = as.zoo(obj)
obj = aggregate(obj, format(time(obj), "%m"), mean,na.rm=TRUE)
sp = SpatialPixelsDataFrame(pix, data.frame(t(obj)))

you may need to give the data.frame() meaningful names before passing
them into the SpatialPixelsDataFrame.

On 07/25/2013 05:09 PM, Nicolas Bories wrote:
> Edzer, Thanks for helping me and sorry for my late answer. I think
> didn't express myself very well. Actually, I would like, for each
> pixel, to have a mean year (23 values). So each value will be an
> average of the EVI at the same date for the 10 years.
> 
> Regards,
> 
> Nicolas.
> 
> On 27/06/2013 12:34, Edzer Pebesma wrote:
>> Given your data are in obj, did you try
>> 
>> mean.yrs = aggregate(obj, "year", mean)
>> 
>> ?
>> 
>> On 06/27/2013 10:56 AM, Nicolas Bories wrote:
>>> Dear all,
>>> 
>>> I'm working on EVI-MODIS time series with the R package
>>> spacetime. I have 10 years of data. I want to compute an
>>> average year for each pixel. How can I do this ? The goal is to
>>> compare for each pixel and for specific years the EVI-MODIS
>>> variations and average year variations. I saw the method
>>> aggregate(x, by, FUN = mean, ..., simplify = TRUE) but I didn't
>>> manage to get an average year.
>>> 
>>> Thanks in advance for any suggestions !
>>> 
>>> Nicolas.
>>> 
>>> 
>>> [[alternative HTML version deleted]]
>>> 
>>> _______________________________________________ R-sig-Geo
>>> mailing list R-sig-Geo at r-project.org 
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> 
> 
> 

- -- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJR8WJKAAoJEM1OCHCtOnfxVcEH/ApXIKfhPviSO3do3LwmWEd4
qZlLD+zJt92QsEb8fD8uKDNyvdiWTrcHLCDJRA9zx6xS0CUQMYVPZ5RNffcBpv3G
DvmwXhEMkNEfjjF1wj9Ft+SXFQDzgDbm6fNfNO6J4TI+kjPSrfk3nV8LnnZZxsMh
Ws0JFZ2UFsQ8vqIB3M0M6OsFxGXAvLwys0nvrcOJ0BscQOWU7eHp4Qjgbren3/5F
faEBAwuYvkie9iTblZv01XrVbEmPTyxkbi1xATtFcoYqdCsfnLkHFEjs8NWvjzMn
ZV88CA9z04JkvnVWHMS5M4utxE8HAvINlcdeOzC2Lo5XoxFJraJZ/WkqNkN+EtQ=
=jJfR
-----END PGP SIGNATURE-----



More information about the R-sig-Geo mailing list