extracting trends
regression <- function(x) {
df <- data.frame(yy = 1978:2017, temp = as.numeric(x))
coef(lm(temp ~ yy, data = df))[2]
}
trend$coef <- round(apply(trend[, -1:-4], 1, regression) * 100, 1)
trend <- st_as_sf(trend, coords = c("X", "Y"), crs = 4326)