added R code to visualize position shifts