You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error occured when using Rscript command line tool to build a book in bookdown #592
Because of the cross-reference feature, I am using bookdown instead of rmarkdown to generate dynamic reports. I have more than one reports to generate, so I drafted an R script to call bookdown:render_book in a for loop to generate all the reports. Unfortunately, it errored. For simplicity, I build one minimal example:
I guess all the environmental variables are lost when "knitting" the "R Markdown" files through bookdown in command line tool. Given that rmarkdown succeeded in tackling this issue, I guess it could be solved in bookdown, too.
Oh, it is my fault. The function bookdown::render_book has set the argument clean_envir as !interactive(). It is this behavior that causes the error. So I did a little modification to my index.Rmd, then it worked:
@psychelzh I was searching the web/debugging for 24 hours until I came across your post. I was getting an error that the name of my file to be rendered (e.g. 'index.Rmd') was missing, followed by this:
<Anonymous> -> <Anonymous> -> resolve -> basename
Basically, I am calling "Rscript" multiple times to render N reports, and when I ran them independently, I had no errors, but then when calling them through a system command, I had the above error.
Thanks for sharing this. I skipped over this argument in the render_book docs.
Activity
psychelzh commentedon Jun 16, 2018
I guess all the environmental variables are lost when "knitting" the "R Markdown" files through
bookdownin command line tool. Given thatrmarkdownsucceeded in tackling this issue, I guess it could be solved inbookdown, too.psychelzh commentedon Jun 17, 2018
Oh, it is my fault. The function
bookdown::render_bookhas set the argumentclean_enviras!interactive(). It is this behavior that causes the error. So I did a little modification to myindex.Rmd, then it worked:So close this.
yihui commentedon Jun 17, 2018
When you cross-post issues, please mention it. Let's keep everyone in the same thread. Thanks!
https://stackoverflow.com/q/50888871/559676
psychelzh commentedon Jun 17, 2018
Okay, thanks!
dmanuge commentedon Dec 18, 2018
@psychelzh I was searching the web/debugging for 24 hours until I came across your post. I was getting an error that the name of my file to be rendered (e.g. 'index.Rmd') was missing, followed by this:
<Anonymous> -> <Anonymous> -> resolve -> basenameBasically, I am calling "Rscript" multiple times to render N reports, and when I ran them independently, I had no errors, but then when calling them through a system command, I had the above error.
Thanks for sharing this. I skipped over this argument in the
render_bookdocs.github-actions commentedon Nov 6, 2020
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.