Command for “Set working directory to source file location”

前端 未结 4 1725
眼角桃花
眼角桃花 2021-01-17 14:50

RStudio has a useful feature:

Session -> Set Working Directory -> To Source File Location

Is there a way to do this without using the

4条回答
  •  迷失自我
    2021-01-17 15:37

    pathwd<-sub("/filename","",system("find -perm -g=w -type f -name 'filename'",intern=T)[1])
    setwd(pathwd)
    

    Make sure your file's name is unique.

提交回复
热议问题