I am working with MODIS time series data, and I want to stack a stack object to prepare my data for multiple regression.

I have AMSR (soil moisture) as a response variable and I have some explanatory variables such as NDVI and LST and Albedo for a period of 6 months (183 images for each variable).

I want to perform multiple regression analysis between these variables. For a one particular day I can easily use “stack” command to stack the variables for one day and then create data.frame from the stack object, but to apply to the all-time series data I could not find a solution. I guess I should stack the list.files for each variable first, and then stack the stack objects again.

However, this has not worked.

closed as off-topic by PolyGeo Sep 14 '18 at 20:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • You should be able to stack multiple RasterStack objects. Are you getting a warning when attempting to stack them? If so, will you share it? I don't want to jump to assumptions, but the most common error you will run into is misaligned pixels or differing extents. If this is the case, you will first have to run raster::resample() and raster::crop(). – Jackson Mar 16 '18 at 19:07