This repository contains a Jupyter notebook file which walks you through the basics of using notebooks and RStats for reproducible data analysis. It starts with a general guide to the notebook format and how to install the necessary software. Then it goes through an example using R to load data, filter missing values, create graphs and run statistical tests.
Download this folder of code to your local machine amd then either
- In RStudio - navigate to the downloaded folder, open
install.R
and run the code to install the necessary packages. Then openindex.Rmd
. - In Jupyter - install and launch Jupyter via Anaconda Navigator or similar. Then, in Jupyter, navigate to the downloaded folder and open
index.ipynb
.
MyBinder.org provides a way of sharing fully functionally interactive notebooks over the internet. It works by compiling and hosting a Docker instance with a fixed set of all the necessary software to run the notebook.
This example can to launched and run from Binder. Click one of these black and red buttons. Both RStudio and IRKernel are installed by default, so you can use either the Jupyter notebook interface or the RStudio interface for R projects.
This tutorial is about Jupyter in combination with R. To launch it press this button >>
Once it has started itself up, launch the tutorial by clicking index.ipynb
Beware, that if it hasn't been used recently, it can take a very long time to recreate the virtual machine. *Beware, all changes will be lost when you close the binder session. If you want to *
If myBinder doesn't work you can run the same code via the Google Colabatory
Use the following link: https://colab.research.google.com/github/InfantLab/NotebookDemos/blob/master/index.ipynb
Also included is a example of using R's intereactive plotting system Shiny using the famous Gapminder data (originally from cameres ). See if you can spot (and fix) the deliberate mistake.
One nice thing about MyBinder is that it supports using R + RStudio, with libraries pinned to a specific date snapshot of software from the MRAN repository.
When MyBinder loads it looks for the included file runtime.txt
in this folder. This is a plain text file formatted like:
r-<YYYY>-<MM>-<DD>
where YYYY-MM-DD is a snapshot at MRAN that will be used for installing libraries. This means that all libraries are frozen to that version and so results will be same everytime you use it.
You can also have an install.R
file that will be executed during build,
and can be used to install the R libraries you require to run your code. It has the format
install.packages("dplyr")
install.packages("ggplot2")
Forked from https://github.com/binder-examples/r
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.