main.r367 chars11 lines
This function takes as input a path_to_script variable that must contain a string path to the R script to extract the path declarations from. The readLines function is used to read in all of the lines of the script into a character vector.
Then, the grep function is used to extract only the lines that declare a path, and the sub function is used to extract the path itself from each of these lines.
Finally, the extracted paths are returned as a character vector.
gistlibby LogSnag