R code for sampling and jittering within regions