Skip to content
Joe Marlo edited this page Aug 11, 2022 · 20 revisions

thinkCausal wiki

Welcome to the thinkCausal wiki. thinkCausal is federally funded project devoted to building scaffolded causal inference software implementing Bayesian Additive Regression Trees. You can find a live, beta version here.

If you would like to contribute, please seeing the contributing guidelines.


Running the app in a local developer environment

Clone the repository to your machine use git clone in terminal. Run renv::restore() in R to download the dependencies. Run /thinkCausal/dev/run_dev.R script to launch the app.

To instead install the latest code as a package, use:

remotes::install_github('priism-center/thinkCausal_dev', subdir = 'thinkCausal')
thinkCausal::run_app()

Code guidelines

thinkCausal is a mix of 'base' R and tidyverse code. We try to adhere to the tidyverse style guide for code formatting. The easiest way to to format ~90% of your R code is Code -> Reformat Code within Rstudio.

We use roxygen2 for documenting functions and testthat for unit testing. Please familiarize yourself with both and feel free to reach out with an issue if you have any questions.

Independent lessons should be written as modules. See the wiki for details.


Dependencies

We use renv to manage dependencies. You can use renv::restore() to install all the necessary packages. Please limit adding additional packages. Do not add thinkCausal as a dependency even if renv suggests it.


Application structure

The application is built on R Shiny and uses the golem opinionated framework. Each page is its own Shiny module which enables it to have its own namespace.

golem

{ the golem dev commands }

The store object

Any data that needs to passed between the main server and modules or between modules should be saved to the store object. This is equivalent to "stratégie du petit" in the Engineering Shiny book.

Repo structure

master branch - Production branch. Is deployed on push/pull to apsta.shinyapps.io/thinkCausal
dev branch - Primary developer branch. Is deployed on push to apsta.shinyapps.io/thinkCausal-dev
gh-pages branch - Automatically created branch from the /_site folder that builds to a static website
{other} branch - Unique branches for new features or individual developer work

Directory structure

.
├── LICENSE
├── README.md
├── scratch/                  Scratch work
├── screenshot.png
├── _site/                    Static website that builds priism-center.github.io/thinkCausal_dev/
├── student_work/             Store for student's work
├── thinkCausal
│   ├── app.R                 App for pushing to shinapps.io
│   ├── DESCRIPTION
│   ├── dev/                  Scripts for developing the app via the `golem` framework
│   │   ├── 01_start.R
│   │   ├── 02_dev.R
│   │   ├── 03_deploy.R
│   │   └── run_dev.R
│   ├── inst/                 Content to build in the R package including the web application
│   │   ├── app
│   │   ├── extdata           Store for external data such as csvs
│   │   ├── golem-config.yml
│   │   ├── reproduce
│   │   └── WORDLIST
│   ├── LICENSE
│   ├── LICENSE.md
│   ├── man
│   ├── NAMESPACE
│   ├── R/                    All R functions and modules
│   ├── renv
│   ├── renv.lock
│   ├── tests
│   └── thinkCausal.Rproj
└── writing/                  Store for various writing such as vignette prototyping
Clone this wiki locally