1.2 Get started
The easiest way for beginners to get started with writing a book with R Markdown and bookdown is through the demo
bookdown-demo on GitHub:
Install the RStudio IDE. Note that you need a version higher than 1.0.0. Please download the latest version if your RStudio version is lower than 1.0.0.
Install the R package bookdown:
bookdown-demorepository you downloaded in RStudio by clicking
Open the R Markdown file
index.Rmdand click the button
Build Bookon the
Buildtab of RStudio.
Now you should see the index page of this book demo in the RStudio Viewer. You may add or change the R Markdown files, and hit the
Knit button again to preview the book. If you prefer not to use RStudio, you may also compile the book through the command line. See the next section for details.
Although you see quite a few files in the
bookdown-demo example, most of them are not essential to a book. If you feel overwhelmed by the number of files, you can use this minimal example instead, which is essentially one file
index.Rmd: https://github.com/yihui/bookdown-minimal. The
bookdown-demo example contains some advanced settings that you may want to learn later, such as how to customize the LaTeX preamble, tweak the CSS, and build the book on GitHub, etc.