Skip to content
Prev 23647 / 29559 Next

How to perform cross-year date operations on rasters?

On Thu, 5 Nov 2015 at 09:38 Thiago V. dos Santos <thi_veloso at yahoo.com.br>
wrote:
You can subset on the dates, by running a test on the date values:

ldates <- format(getZ(s), "%m") %in% c("10", "11", "01")

subsetting the object

subset(s, which(ldates))

and finally calculating what you want

calc(subset(s, which(ldates)), sum)

HTH