4

I read this topic: R command for setting working directory to source file location

But this function prints error:

this.dir <- dirname(parent.frame(2)$ofile)
setwd(this.dir)

Error in dirname(parent.frame(2)$ofile) : a character vector argument expected

How can I set working directory to source file location?

Community
  • 1
  • 1
ргдшщ
  • 83
  • 3
  • 8

0 Answers0