Monthly Trend Analysis

Hey, I am running analysis for forest change trend analysis, and need monthly trend. I got this code from one of the website. It is for all time frame and give me 1 map only. How I can adjust it in a way that the result is monthly?

print(TEMPRA_SA)
class      : RasterBrick 
dimensions : 10, 13, 130, 756  (nrow, ncol, ncell, nlayers)
resolution : 0.6666667, 0.5  (x, y)
extent     : 30, 72.66667, 37.75, 20.75  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
source     : memory
names      : Temperature.1, Temperature.2, Temperature.3, Temperature.4, Temperature.5, Temperature.6, Temperature.7, Temperature.8, Temperature.9, Temperature.10, Temperature.11, Temperature.12, Temperature.13, Temperature.14, Temperature.15, ... 
min values :      259.0756,      258.5136,      259.3398,      266.9830,      275.9693,      280.7002,      282.6064,      282.5108,      275.4917,       268.4222,       261.3912,       253.3347,       253.2488,       253.0675,       259.1397, ... 
max values :      281.0044,      281.1099,      281.6156,      287.4892,      294.8130,      301.7237,      303.4146,      302.9601,      297.3324,       290.3503,       284.2727,       275.8601,       276.0049,       276.2153,       280.7115, ... 
Date       : 1948-01-01, 2010-12-01 (min, max)

> time <- 1:nlayers(TEMPRA_SA)
> fun=function(x) { if (is.na(x[1])){ NA } else { m = lm(x ~ time); summary(m)$coefficients[2] }}
> tempra.slope=calc(TEMPRA_SA, fun)
> tempra.slope=temp.slope*63
> print(tempra.slope)
class      : RasterLayer 
dimensions : 10, 13, 130  (nrow, ncol, ncell)
resolution : 0.6666667, 0.5  (x, y)
extent     : 30, 72.66667, 37.75, 20.75  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 
source     : memory
names      : layer 
values     : -0.01569143, 0.1297974  (min, max)

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Please help.... Need it for my bachelor thesis

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.