I am working out some tutorials in R. Each R code is contained in a specific folder. There are data files and other files in there. I want to open the
I know this question is outdated, but I was searching for a solution for that as well and Google lists this at the very top:
this.dir <- dirname(parent.frame(2)$ofile) setwd(this.dir)
put that somewhere into the file (best would be the beginning, though), so that the wd is changed according to that file.