create the R script for the interaction of distance and democracy