Correcting path problems in R script