-
-
Notifications
You must be signed in to change notification settings - Fork 978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify that the output_file
directory is relative to the input
directory
#2370
Comments
Lines 339 to 345 in f2bfeec
Lines 493 to 497 in f2bfeec
Paths handling in rmarkdown is quite complex and we have encountered some limitations already (https://github.com/rstudio/rmarkdown/issues?q=is%3Aopen+label%3A%22theme%3A+paths%22+sort%3Aupdated-desc). Technically, there is even nothing that prevents the paths to be absolute too or relative but in a parent folder (e.g
What was the issue exactly ? This may yet be another limitation we have. |
output_file
directory is relative to the input
directoryoutput_file
directory is relative to the input
directory
I recognize that file paths are complex here. Having worked on something vaguely similar in the past (though FAR less complex), I know it's nontrivial to keep all the parts moving correctly. (That's why I indicated this as a documentation issue rather than a bug.) The reprex is below. When I traced the "The directory 'issue2370' does not exist" error, it was looking for an issue2370/issue2370 directory under The thing for me is that I did not specify This is on Windows 10, R 4.1.2, rmarkdown 2.14. tempdir()
#> [1] "C:\\Users\\BILLDE~1\\AppData\\Local\\Temp\\Rtmpwdx1y6"
newdir <- file.path(tempdir(), "issue2370")
dir.create(newdir)
setwd(file.path(newdir, ".."))
file_to_create <- "issue2370/foo.Rmd"
cat("---\ntitle: 'Untitled'\nauthor: 'William Denney'\ndate: '2022-06-06'\noutput: pdf_document\n---\n\nfoo\n", file=file_to_create)
rmarkdown::render(input=file_to_create, output_file="issue2370/foo.pdf")
#> Error: The directory 'issue2370' does not not exist. Created on 2022-06-06 by the reprex package (v2.0.1) |
Thanks I'll look into this, and adapt the documentation |
I just hit an unexpected issue that appears to be documentation related.
It appears that the directory for the
output_file
should be relative to the directory ofinput
rather than relative to the current working directory wherermarkdown::render()
is run. I think that this could be clarified by adding "Theoutput_dir
is relative to the directory forinput
and not relative to the current directory."And, that clarification would go about here:
rmarkdown/R/render.R
Lines 171 to 178 in f2bfeec
The text was updated successfully, but these errors were encountered: