I have been trying to get the script name of an R script in R console. For example, I have the name of the R script “example.R”. I want to have this name as an assigned variable. I would like to do this without using basename()
because I would like to define the working directory with the help of the name of the script as a variable.
I tried scriptName
package and current_filename()
function but it somehow gives me NULL. I expected to have the script name but I couldn’t have it. Does anyone have any idea how to do this?