Needed to change .R to .r on distances.r