# NOT RUN {
# You can apply any function to subsets of rasters in the stack,
# by selecting the layers with double brackets.
transform_rasters(raster_stack = df_tmax,
total_1sem = sum(tmax[1:6]),
mean_1sem = mean(tmax[1:6]),
sd_1sem = sd(tmax[1:6]))
# }
Run the code above in your browser using DataLab