-
Notifications
You must be signed in to change notification settings - Fork 45
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
Question about knitting vs. running chunks ("Run All") #4
Comments
Thanks. Could you please point me to your project, or attach an archive? |
In this example "Run All" chunks works. Knitting does not. When changing I also played around with You will need (Maybe its also a simple |
Thanks. I'm seeing correct behavior with a simple document that is rendered with Here's the minimal file I'm using in my tests:
Can you confirm that it works correctly with the following file:
|
Thanks for looking into it. I get the following error with
Using
Setting |
Does my example file work for you? After deleting the cache I can run the first example, it works as expected both for "Run all" and "knit". |
It works and it also works using However, I'm kind of lost right now. What does not work is the original source from which the example, which I sent to you, was extracted. It has the same files, the same code and the same directory structure. Knitting there, I get
for both # list files
file <- here("spring-school-hsdar/data") %>% list.files(pattern = ".tif$", full.names = TRUE) and knitting only works when using You proofed that it works correctly and I can reproduce it on my local copy. So I assume that there is some nasty stuff going on in my source...(which I do not want you to bother with). Thanks for your time checking the files etc! Much appreciated! I'll let you know if I'll ever find out what's going on here. |
I'm getting consistent results with the following example, too:
I'd suggest you try to remove code from your document step by step until the problem disappears. And I'd definitely be interested in the cause of this weird problem! |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
When running all chunks of my .Rmd file ("Run All"),
here()
is set to the R-project root dir. All paths are relative to this directory. Let's call it "main-dir".The .Rmd file is placed one dir below the project root, let's say in "main-dir/sub-dir". When I knit the .Rmd file, I get
.local object
errors becauseknitr
uses "sub-dir" as root dir when knitting.Currently my workaround is to use a second R-project in "sub-dir" to ensure that both knitting and running all chunks works with the same relativ paths (and that my folder structure does not get messy).
I wonder what I'm doing wrong here so that
here()
is not adjusting paths correctly in my case. I initially expected thathere()
is setting the working directory to the project root when knitting. Did I get this wrong? 😅The text was updated successfully, but these errors were encountered: