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:

  1. Download the GitHub repository https://github.com/rstudio/bookdown-demo as a Zip file, then unzip it locally.
  2. 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.
  3. Install the R package bookdown:

    # stable version on CRAN
    install.packages("bookdown")
    # or development version on GitHub
    # devtools::install_github('rstudio/bookdown')
  4. Open the bookdown-demo repository you downloaded in RStudio by clicking bookdown-demo.Rproj.
  5. Open the R Markdown file index.Rmd and click the button Build Book on the Build tab 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.