See a minimal example of a book based on R Markdown and bookdown (https://github.com/rstudio/bookdown). See the page "Get Started" at https://bookdown.org/yihui/bookdown/ for how to compile into HTML. You may generate a copy of the book in bookdown::pdf_book
format by calling bookdown::render_book('index.Rmd', 'bookdown::pdf_book')
. More detailed instructions are available here https://bookdown.org/yihui/bookdown/build-the-book.html.
You can find the preview of the example at https://bookdown.org/yihui/bookdown-demo/.