Step 4: Build Rmd into HTML

RStudio gives you full access to the R statistical programming language, and it has some fun features that make working with Rmarkdown more enjoyable. We’ll draw some of those details out later. For now let’s keep our eyes on the prize.

  1. Open the _build.sh file from the Files pane in RStudio. It will recognize it as a shell script. Press the Run Script button in the top right corner of the _build.sh tab. This script simply does some directory housekeeping and runs the bookdown command that will compile your source documents into HTML.

    If this step fails, it is likely because there is a syntax error somewhere in your document. Try to read the console output to get a sense of where the error is, or enter traceback() from the console to get more clues about the origins of errors.

  2. This step will likely be a stumbling block for many of us, so we need to lean back on our skills in making issues on GitHub.com.

    Add an issue with your error messages to your own portfolio repository, then assign the issue to your instructor and any other collaborators that you want to ask for help. After you’ve made your issue, post a link to it on Slack, which will be a great place to help each other out as well.

  3. If it did work you will in the Console see a line that says:

    Output created: _book/index.html
    [1] "/home/rstudio/_book/index.html"

    Lots of other HTML output was also created, but index.html is landing page for your portfolio!
    Find it from the RStudio Files browser

    Not the File menu, but rather Files on the lower right with Files|Plots|Packages|Help|Viewer

    Open the folder called _book.
    Click index.html then View in Web Browser.
    You should see your source rendered as a nice HTML “gitbook”.

Savor the feeling! At this point you may be inspired to go back and edit your source to work on the composition itself. That’s a great motivation; seeing your work in publication format tends to stir the creative juices!

You’re ready for Step 5: Deploy to w201rdada.github.io!