My R Markdown script was running well until I had to access documents from another WD than my RMarkdown-file. I tried to change the WD. But it doesn't take it. I might access documents from different folder during my R Markdown Document. How can I be more flexible without coping my files into R Markdown folders? (that would be wasting space!)
Is this the right command?
knitr::opts_knit$set(root.dir = "C:/Users/Nadine/OneDrive/ZID_Kurse/Einführung/Kursmaterial")
And do I need to put it in the beginning of the document??? It just halts at the chunk with setWD() command.
Cheers, Nadine
CodePudding user response:
You probably do not need to change the working directory; just explain where to find the files relative to the project working directory. You can use an absolute path to the files on the filesystem, e.g.
list.files("C:/projects/another_project/data/")
Or you may try to use relative paths to navigate to files through the parent directory. e.g.
list.files("../another_project/data/")