finished R function on PastClimate extraction