Before we meet for our first class there are few things you should try at home to get started.

Install R and R Studio

  1. Download and install R on your computer. This is the R website https://www.r-project.org
  2. Download and install R-studio. You must download and install R first before installing R-studio. The R-studio website is https://www.rstudio.com

Github.com and Github Desktop

  1. Create a free github account. The github website is https://github.com
  2. Download and install github desktop https://desktop.github.com

Test the pipeline

This semester students will be submitting their work as github repositories. Follow these steps to test the github pipeline to make sure it is working:

  1. Create a new R project (initialize with git)
  2. Create a new R Markdown document
  3. Publish the R project folder on Github.com
  4. Make commits and demonstrate that your local changes are reflected on github.com

RStudio Cloud and Github.com

If you are unable to install R, RStudio, and Github desktop on your computer, then an alternative option is to use RStudio Cloud, which runs in your web-browser. RStudio Cloud also works with Github.com. Follow these steps, and/or watch the screencast for this method. Note, these instructions were slightly modified from Symphony Yu’s blog post.

  1. Create a free account with RStudio Cloud at https://rstudio.cloud
  2. Create a free account with Github.com at https://github.com
  3. Log in to Github.com, and create a new repository. You will use this repository to save your assignments and other course work.
  • give it a name (e.g., PSYC7765stats)
  • click the option to initialize with a readme
  • click create repository
  1. Log in to https://rstudio.cloud
  2. Select New Project > New Project from Git Repository
  • copy url to the repository you made from Github.com
  1. RStudio Cloud will pull in the files from the Github repository, and you should be viewing R Studio in your browser

You can now use R Studio in the cloud. Any new files that you make will be saved to the project folder you made in R Studio Cloud. However, these files will not be “pushed” to Github.com. In order to push the files to Github.com, follow the next steps:

  1. From the R studio menu, click “Tools” > “Global Options”
  2. Select Git/SVN (on the left side).
  3. Click “Create RSA Key”, click “Create”.
  • close the textbox
  • click view public key
  • copy the key
  1. Go to your Github user settings, and select “SSH and GPG keys”, and click “New SSH key”. Give your key a title, paste the key into the Key textbox, then click “Add SSH key”.
  2. Go back to your RStudio Cloud project
  • go to the Terminal tab on the bottom panel of your window.
  • in the terminal follow these steps, by typing the commands, and pressing return

Replace inside the quotations with the email associated with your Github.com account

git config --global user.email "you@example.com"

Replace Your Name inside the quotations with your Github username.

git config --global user.name "Your Name"

In the terminal, type the following, but replace YourUsername and YourRepo with your Github username and Github repository name (as it is written in your Github repository URL):

git config remote.origin.url git@github.com:YourUsername/YourRepo.git

You should now be able to use the git tab in R studio to push and pull files between R Studio Cloud and Github.com. See examples in the screen cast.

Why are we using R for this statistics lab?

A quick attempt to explain why I think it is totally worth it to learn R for data-analysis, and for psychologists in general.

RStudio run through

A look through some of the features of RStudio.

Basic R programming overview

We will take a number of different approaches to using R to learn about statistics this semester. One of the approaches will be to learn about basic coding/scripting in R, which can become an entire course on its own. This video gives an impression of what coding looks and feels like in R Studio, and introduces some basic coding concepts such as variables, logic, loops, and functions.

Practice problems

In addition to lab material, I will be posting additional screencasts here that provide more angles on learning R basics. For example, it can be useful to have specific problems thta you are trying to solve, and then set yourself the goal of figuring out how to solve the problems in R. I have a created a list of problems here https://crumplab.github.io/programmingforpsych/programming-challenges-i-learning-the-fundamentals.html. Some of the problems will be assigned in lab. Here, my plan to do some live coding, showing ways that I solve these problems.