Hi all,
I am facing a problem to work on bookdown in R markdown: When I am trying to run this chunk:
Read the help file of the function bookdown::render_book
This error comes out
Error in bookdown::render_book("intro.Rmd", "bookdown::pdf_book") : The file _main.Rmd exists. Please delete it if it was automatically generated. If you are sure it can be safely overwritten or deleted, please set the option 'delete_merged_file' to true in _bookdown.yml.
Additionally, while knitting this error output is found:
Error in render_book(input_file, output_format, envir = envir, preview = TRUE) :
The file _main.Rmd exists. Please delete it if it was automatically generated. If you are sure it can be safely overwritten or deleted, please set the option 'delete_merged_file' to true in _bookdown.yml.
Calls: -> -> render_book
Execution halted
Bookdown relies on rmarkdown. Both render Rmd files. As such, _main.Rmd will exist already by the time you attempt to use bookdown. I’m not sure how you could work around this, but I also don’t understand why you are trying to render a book from inside Rmarkdown.
What are you trying to accomplish? Perhaps there is an easy alternative to this workflow.
Thanks for your feedback. Actually, I am trying to complile the rmd files (the chapters) into a book as a task for my Data Management (R) graduate class project for this semester.
Previously, when I created this project, added individual chapters (rmd files named as Introuction, Graphics, ggplots etc.) and tried to compile, it worked but a few weeks later I found errors.
I don't know why it happened or if I did anything wrong with R? I am actually a beginner and thus really fumbling around on this issue.
Actually, I have created several chapters (as individual rmd files) and added them to the book as I followed instructions from my friend. To check if the blank draft works I knitted it and it worked but weeks later when I tried it again I could not generate pdf book.
What you should do is download the minimal demo book and open the project file. Uncomment the PDF line if you want a pdf. Click “build book” in the interface to try it out.
Then, to add your own content, all you need to do is add your own Rmd files. No need to modify commands or add lines of code. They will be found and added automatically. They will be added in alphabetical order, so you might want to put numbers at the beginnings of the names in order to get them in the order you want. Hope that helps.