How can I determine the current directory name in R?

后端 未结 2 2067
庸人自扰
庸人自扰 2021-01-07 19:03

The only solution I\'ve encountered is to use regular expressions and recursively replace the first directory until you get a word with no slashes.

gsub(\"/\         


        
2条回答
  •  死守一世寂寞
    2021-01-07 19:28

    If you didn't know basename (and I didn't), you could have used this:

    tail(strsplit(getwd(), "/")[[1]], 1)
    

提交回复
热议问题