Skip to content

Latest commit

 

History

History
80 lines (57 loc) · 3.09 KB

analyzing-data-archive-2012-2016.md

File metadata and controls

80 lines (57 loc) · 3.09 KB

Analyzing data (OLD METHOD)

Note that this is the method used to analyze data from July 2012 through July 2016. Updated data analysis procedures are found here.

I analyze my data with an R kernel in Jupyter notebooks. A Jupyter notebooks is a document that contains executable code along with text and figures. Here is an example of one of my analysis notebooks.

Setup Jupyter notebook

Before you can analyze data, you must install the jupyter notebook. You can do this with conda. The computer you are using should already be setup with miniconda. You can check whether the computer has miniconda by going to the terminal and typing the following:

conda info

If you get information about the current conda install, you can proceed. If you get a notice -bash: conda: command not found, visit setting up a computer for instructions on installing miniconda before you proceed.

First we are going to create a conda enviroment for the Jupyter notebook with the packages required to run the R kernel. We will name the package jupyter.

conda create -n jupyter -c r r-essentials

Next we navigate to the new conda environment

source activate jupyter

And install jupyter into that environment

conda install jupyter

To exit the environment, type

source deactivate

Opening the Jupyter notebook

To analyze data with Jupyter, you must activate the jupyter conda environment you created.

source activate jupyter

When you do this, you should see something like this appear in the terminal.

Once the jupyter environment is active, you can navigate to the analyses folder. (For research assistants, this is the 'Kschuler-current/analyses' folder in the learninglab Dropbox)

cd ~/Dropbox/Kschuler-current/analyses

And then open the jupyter notebook.

jupyter notebook

The notebook should be available at http://localhost:8888/ (or some other port number).

jupyter notebook

A browser will open with the jupyter notebook. You can click on any of the .ipynb files to open that particular notebook.

jupyter browser

My favorite R packages

  • %>%
  • dplyr
  • ggplot2

Data Day resources

For research assistants attending the summer data analysis meeting (Mondays at 10:30!)

Data Day 1 - June 13, 2016