How to set the current file location as the default working directory in R programming?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to make the current file location as the working directory. Using Rstudio (Works!): # Author : Bhishan Poudel # Program : writehere.r # Source : Rscript writehere.r # set working directory here this.dir Using Command from terminal : Rscript writehere.r (Does not work!) Error in dirname(parent.frame(2)$ofile) : a character vector argument expected Execution halted ------------------ (program exited with code: 1) Using Command from terminal : Rscript writehere.r (Works now!) # Author : Bhishan Poudel # Program : writehere.r # Source :