In general, I do not subscribe to the current fancy of putting everything (data exploration, cleanup, analysis, ect.) in a single RMD. It is nice for full reproduceability, but as your data gets large and the analyses take longer you may find that a simple spelling change takes an hour to review in PDF form. Instead I recomend the process described below.
You need to edit the individual chapter R Markdown files to write your dissertation.
You can write in the Rmd files without RStudio (in fact RStudio lacks some conveniences for writing, such as live spell-checking and live word count). So you may prefer to do some writing and editing your Rmd files in your favourite text editor. I frequently use Atom, Notepad++, and Emacs. But I come back to RStudio to create the PDF and work on the R code in my documents.
While writing, you should git commit
your work frequently, after every major activity on your dissertation.
For example, every few paragraphs or section of text, and after major step of analysis development. You should git push
at the end of each work session before you leave your computer or change task.
For gentle novice-friendly guide to getting starting with using Git with R and RStudio, see http://happygitwithr.com/.
To render your dissertation into a PDF, open index.Rmd
in RStudio and then click the "knit" button. To change the output formats between PDF, gitbook and Word , look at the output:
field in index.Rmd
and comment-out the formats you don't want.
Alternatively, if you're not using RStudio, you can use this from the R console, assuming your have set the 'index/
directory as your working directory:
bookdown::render_book('index.Rmd')
The PDF file of your dissertation will be deposited in the _book/
directory.
The following components are ones you should edit to customize your dissertation:
_bookdown.yml
This is the main configuration file for your dissertation. It determines what Rmd files are included in the output, and in what order. Arrange the order of your chapters in this file and ensure that the names match the names in your folders.
index.Rmd
This file contains all the meta information that goes at the beginning of your document. You'll need to edit this to put your name on the first page, the title of your dissertation, etc.
01-chap1.Rmd
, 02-chap2.Rmd
, etc.These are the Rmd files for each chapter in your dissertation. Write your dissertation in these. If you're writing in RStudio, you may find the wordcount addin useful for getting word counts and readability statistics in R markdown documents. You might also enjoy writing in these Rmd files with Atom, Notepad++, Sublime Text, and Emacs.
bib/
Store your bibliography (as bibtex files) here. We recommend using the citr addin and Zotero to efficiently manage and insert citations.
csl/
Specific style files for bibliographies should be stored here. A good source for citation styles is https://github.com/citation-style-language/styles#readme
figure/
and data/
Store your figures and data here and reference them in your R Markdown files. See the bookdown book for details on cross-referencing items using R Markdown.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.