I know that this has been asked several times, but I still am not able to get this to work properly. I have a main script that calls other scripts via source()
. I am writing code currently that could potentially be used by multiple teams of people, so I would like to save the main and all scripts into a single folder that will be able to be run from any file location. To do this, the Main.R needs to be able to self-identify it's own directory. I have been unsuccessful in getting this to run properly, and I am hoping someone would be able to help me with this.
Main.R
#Main script
source("Hello.R")
Hello.R
#side script to be run
print("Hello World")
The problem is that I can't run "Hello.R" unless I set the directory to the folder containing all my scripts.