These notebooks contain the R code written by Richard McElreath, available for download on his website xcelab.net/rm/statistical-rethnking in the file code.txt
I broke each chapter into a separate Jupyter notebook, and devoted one cell to each code fragment.
You will need Richard's R package rethinking installed. Installation instructions and source are available on his GitHub repository:
https://github.com/rmcelreath/rethinking
As with the book, you will need to have RStan installed. McElreath's rethinking repository gives instructions for installing it. You will also need to have Jupyter's R kernel installed, along with, of course, Jupyter Notebook and R.