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
Knit Directory setting can break R Markdown websites #2158
Comments
@jdblischak Thank you for notifying us of this issue! Both "Current Working Directory" and "Project Directory" result in this error when not working in a project. However, when working in a project, these work. |
@jmcphers If this really breaks render_site this might be a candidate for a patch release. |
@ronblum I cannot replicate this. Even in the context of an RStudio project, I still get the same error when either "Current Working Directory" or "Project Directory" is set. In both cases, the argument My directory structure looked like this:
|
Sorry! Ignore my previous comment—I left out a step when I created a project instead of no-project. It fails there, too. |
A minor follow up. This will also affect the Getting Started directions for bookdown since bookdown uses |
@jdblischak Thanks very much for reporting this! We missed this combination when setting up the Knit in Directory feature set. I've just pushed a fix, and will make the fix part of the next 1.1 release should we roll one. Hopefully it won't be likely in the wild as people are unlikely to try to swap the knit directory when working with websites! |
Thanks for fixing this, @jmcphers! I look forward to the next release.
Interesting. What makes you say that? I'd assume the opposite. With just a few R Markdown files, it is easy enough to save them in the directory where you want them to be executed (i.e. no need to change the knit directory). On the other hand, with a website with many R Markdown files, it is cumbersome to save them all in the place to be executed, especially if you want the files to be executed from the project directory. |
I just did this in the wild! (Broke my website by having "Evaluate chunks in directory: Project" set from another session and got a I was playing around with the "Evaluate chunks in directory" dropdown menu in RStudio -> Preferences -> R Markdown to see if it did what I thought it did, and didn't realize I could also change it under the "Knit" dropdown menu. Not sure whether this is related, but the dropdown menu for "Evaluate chunks in directory" in the RStudio -> Preferences -> R Markdown doesn't seem to reflect the currently set Knit Directory. It always shows "Document" even if I switch it to "Project", hit "Okay", have the Rmd successfully knit using the Project directory as the knit directory, then go back to the RStudio -> Preferences -> RMarkdown tab. The checkbox under the Knit -> Knit Directory dropdown does move between "Project Directory" and "Document Directory". Is this expected behavior? |
@mikoontz I observe the same behavior with RStudio Desktop 1.1.423. Changing the Knit Directory with the dropdown menu does change the Knit Directory, but it is always reset to Document if I go back to the settings. It would be really convenient if this option (and really so many options) could be easily specified in an RStudio project file to allow for different behaviors in different projects. Changing the Knit Directory for one project doesn't mean I want to use that Knit Directory for every single R markdown file I execute. |
System details
Steps to reproduce the problem
_site.yml
index.Rmd
in the same directory as_site.yml
Describe the problem in detail
RStudio v1.1 introduced a new feature to change the knit directory via PR #904. This new feature causes problems for R Markdown websites. The argument
knit_root_dir
can be passed directly tormarkdown::render
, but RStudio usesrmarkdown::render_site
if it detects a website. Becausermarkdown::render_site
does not have the argumentknit_root_dir
, it throws an error like the following:Describe the behavior you expected
Since
rmarkdown::render_site
does not have the argumentknit_root_dir
, I expected RStudio to ignore the Knit Directory setting when executingrmarkdown::render_site
.I am using rmarkdown 1.8, which is the latest CRAN release. Please let me know if there is any other information that would be useful.
The text was updated successfully, but these errors were encountered: