- The R code by Joy Shi and Sean McGrath is available here
- The Stata code by Eleanor Murray and Roger Logan is available here
- The book by by Hernán MA and Robins JM is available here
- These files are rendered using bookdown.
- If you have downloaded/forked this repository you can install the R dependencies with (assuming your working directory is at the top level of the repo):
# install.packages("devtools") # uncomment if devtools not installed devtools::install_dev_deps()
- You can install the Stata dependencies, in Stata, with
do depdendency
-
If you need to install LaTeX, in R install the tinytex package (which is included in the dependencies) and run
tinytex::install_tinytex()
-
Render all formats
rmarkdown::render_site(encoding = 'UTF-8')
-
Render the PDF book
rmarkdown::render_site(output_format = 'bookdown::pdf_book', encoding = 'UTF-8')
-
Render the HTML book
rmarkdown::render_site(output_format = 'bookdown::gitbook_book', encoding = 'UTF-8')
-
Render the EPUB book
rmarkdown::render_site(output_format = 'bookdown::epub_book', encoding = 'UTF-8')
-
Preview a specific chapter
bookdown::preview_chapter("chapter-filename.Rmd")
-
To build the chapters containing Stata code:
- You need Stata installed on your machine.
- Running
devtools::install_dev_deps()
should install the Statamarkdown package by Doug Hemken. - The Statamarkdown package needs to be able to find your installed Stata.
- In Stata, install the Stata dependencies, in Stata, with:
do dependency
.