D ?ear community, This is to kindly request for your help. I have an error from regression of values in one stack with another # s1 and s2 have 720 layers; coefficients[2] is the slope ### script rstack1 <- stack(s1,s2) s <- stack('D:/Correlation/rstack.tif') fun <- function(x) { lm(x[1:360] ~ x[361:720])$coefficients[2] } x1 <- calc(s, fun) I get the following error: Error in .calcTest(x[1:5], fun, na.rm, forcefun, forceapply) : cannot use this function Many thanks for your help in sloving this problem John ? [[alternative HTML version deleted]]