how to set working directory in r in batch file code example Example: r set working directory setwd("/Users/SampleUser/Desktop/R")