calculating annual values
ms %>%
filter(!(mm > 5 && mm < 9 && t2m_mean_mon == 0)) %>%
select(station, X, Y, yy, mm, t2m_mean_mon) %>%
group_by(station, yy, X, Y) %>%
summarise(annual_mean_t2m = mean(t2m_mean_mon), n = n()) %>%
filter(n == 12) %>%
spread(yy, annual_mean_t2m) %>%
na.omit() -> trend