I want to calculate the trend of a raster stack in R, using daily data for 50 years for the whole of Europe.
time <- 1:nlayers(gimms.sum)
fun=function(x) { if (is.na(x[1])){ NA } else { m = lm(x ~ time); summary(m)$coefficients[2] }}
gimms.slope=calc(gimms.sum, fun)
The code above was taken from here [1]. However, I get the message that the vector is 8.6 Gb and cannot allocate the memory
How could I deal with this issue?