1

I am using bfast package for time series analysis. But it requires the files to be read as time series.

How to convert list of stacked images from 2000 to 2013 into a time series and given as input for analysis?

3
  • 2
    Your data needs to be of class "ts". Take a look at the time series objects help page: stat.ethz.ch/R-manual/R-patched/library/stats/html/ts.html
    – Aaron
    Oct 29, 2014 at 12:18
  • 1
    You should have a look at the example in ?bfastts from the bfast package. It demonstrates the conversion of the first pixel of a 'RasterBrick' to a 'ts' object compatible with bfast.
    – fdetsch
    Oct 29, 2014 at 13:46
  • i tried bfastts but im confused about what date i have to give for stack of one year data as my data is 8 day composite data..please suggest me
    – Tharani
    Dec 3, 2014 at 9:21

1 Answer 1

3

You may want to explore the "rts" package. It specifically coerces raster stacks into time series objects. Although, I do not know if they are compatible with bfast.

Your best bet would be to vectorize the problem in a function, passed to overlay, and use @Aaron advice by then coercing into a ts object. This is how I approach time series analysis of climate rasters.

2
  • 1
    Thanks Jeffrey...but the problem has not solved.I am unable to create time series data of 8 day composite which can be given as input for bfast!
    – Tharani
    Dec 11, 2014 at 11:34
  • It would not be a very memory safe approach but, you could read the rasters in using readGDAL in rgdal. This results in a SpatialPixelDataFrame object where each time step is a column in x@data (time=column, pixel=row). You would then iterate through each row (pixel), coerce to a vector then ts object and pass it to the desired function in bfast. I should point out that ?bfast has a clear example of using NDVI data in a timeseries analysis with the function. Dec 11, 2014 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.