if (FALSE) {
# Get only the directory path of the current source file
my_dir <- root()
print(my_dir)
# Example output: "/home/user/my_project/R"
# Get the full path including filename
my_file <- root(includeFName = TRUE)
print(my_file)
# Example output: "/home/user/my_project/R/my_script.R"
# Build a path relative to root
data_path <- root("data", "input.csv")
print(data_path)
# Example output: "/home/user/my_project/R/data/input.csv"
}
Run the code above in your browser using DataLab