Coder Social home page Coder Social logo

ashleypng / cibookex-r Goto Github PK

View Code? Open in Web Editor NEW

This project forked from remlapmot/cibookex-r

0.0 0.0 0.0 58.55 MB

Causal Inference: What If. R and Stata code for Exercises

Home Page: https://remlapmot.github.io/cibookex-r/

License: GNU General Public License v3.0

R 0.27% CSS 0.54% TeX 0.40% Stata 0.07% RMarkdown 98.71%

cibookex-r's Introduction

Repository of R and Stata code for the exercises in Causal Inference: What If by Hernán and Robins

  • 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.

Install dependencies

  • 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
  • For the pdf book please install the Fira Code font on your system from here

Building the book

  • 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.

    • You need to install Doug Hemken's Statamarkdown package, which is now on CRAN and is installed when you run devtools::install_dev_deps(), or install with

      install.packages("Statamarkdown")
    • If your version of Stata is installed at a default installation location the Statamarkdown package will find it. If your version of Stata is installed at a bespoke file path you'll need to set the file path to with something like

      library(Statamarkdown)
      stataexe <- "C:/Program Files/Stata17/StataSE-64.exe"
      knitr::opts_chunk$set(engine.path = list(stata = stataexe))
    • Install the Stata dependencies, in Stata, with:

      do dependency

cibookex-r's People

Contributors

remlapmot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.