79163314

Date: 2024-11-06 15:54:51
Score: 0.5
Natty:
Report link

You could store the root directory of the project at the top of the script using the function find_rstudio_root_file() in package rprojroot:

library(rprojroot)
root.dir = find_rstudio_root_file()

setwd("other_dir") 
# some code working in other dir
setwd(root.dir) 
# come back to the root of the project
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Alf Pascu