At this point you should have downloaded R and R-studio to your own computer. This will allow you to run R and R-studio locally. It is also possible to run R-studio in the cloud through your web-browser. To do this you need to create an account with R-studio cloud. Create an account here https://rstudio.cloud. Note: In class we will be using a computer lab wit R-studio installed on the computers. You will have the option of using the lab computer, or bringing your own laptop, and/or using R-studio through the cloud.
Don’t worry if you ran into issues with these first steps, we will address them in class on Monday.
If you have R-studio working is there anything else you can do before we meet for the first time on Monday? Yes.
You can follow the video tutorial on creating an R markdown website with github pages on the video page. And, you can get started with some of the readings, and you can begin messing around in R. Here are some things to read:
We will be spending the first few weeks of the course working on solving different kinds of coding problems in R. These problems will help you learn the ins and outs of coding in R. You can get a head start by trying to solve the problems in this list of programming challenges.
1. R, R Markdown, Websites, & Github
Overview
Getting set-up with R, R-studio, using R-studio cloud, and Github.
Follow a tutorial to create a free Github account, and then create a webpage using R Markdown and host it for free on Github. Students will use their personal website throughout the course as a mechanism for submitting assignments and to document their progress learning R.
Introduction to basic programming concepts in R (variables, loops, logic, functions)
Create a website using R Markdown and host it on Github pages, then submit the link to your website on Blackboard for Assignment 1. We will create the website in class using this template https://github.com/CrumpLab/LabJournalWebsite
Edit and customize your website to make it your own. Edit the journal page and rename it to “R Basics”.
Use the new “R Basics” .rmd file to begin working through the list of programming challenges. For each problem create a new header, briefly describe the problem, then create a code-block and write code to solve the problem.
Throughout this course you will likely have many questions about how to solve different kinds of problems in R. We will use Github’s issues tracking feature as a way for everyone to post questions and solutions. Go to the github repository for this course https://github.com/CrumpLab/psyc7709. You will see an issue tab, with a “say hello” issue posted. Please add a comment to this issue so that I know that you can post issues. Then, if you have a question about R, please create a new issue. The entire class should be monitoring the posted issues, and anyone who knows an answer can respond with a comment.
2. Basic Programming in R I
Overview
Continue working on solving programming challenges
More discussion on variable types in R, and using loops and logic to create simple algorithms.
Continue adding to your “R Basics” page to document progress in solving programming challenges. Upload link to website showing progress. Students to should attempt all of the simple programming challenges, and begin working on the harder problems. As you complete each problem it is a good idea to try and be creative by solving the problem in different ways. So, it is ok to have multiple solutions for each problem.
New: The new assignment for this week is to learn about existing functions in R, these are called R intrinsics. I have created an assignment worksheet with instructions, https://crumplab.github.io/psyc7709_2019/Presentations/RInstrinsics.html. The assignment contains a list of existing functions. Your task is to create a page on your website. Then, copy the list of functions from the assignment. For each function, you will write a brief description (only needs to be a sentence) of what it does, and then you will write a code chunk demonstrating that you can use the function. This will help you become familiar with existing functions that you can use. If you get stuck and are unable to figure out what a function does, post your question on the github issues tab for this course https://github.com/CrumpLab/psyc7709/issues.
Last week to document progress in solving programming challenges. Upload link to website showing progress. Students should attempt and solve as many of the harder problems as they can.
Create and share an R package containing custom functions on github. Follow the instructions in the R package assignment that we will discuss in class. Upload the link to your new github repository containing your R package to blackboard.
NEW this an addition to your assignment not discussed in class. The assignment instructions are in the github assignment document. This assignment gives you more practice using github features. You will be forking a repo, adding to the code, then making a pull-request to have your new changes be incorporated into the master repository. Also, you will be able to see other students solutions to two of the harder programming problems.
Your assignment is to practice making graphs in ggplot2. Click this link to see the assignment instructions. You will be making a new R markdown page documenting your code for making graphs in the assignment. Load this page onto your website, then submit the link to the page on blackboard.
Due date: M Mar 4th
5. Data-Wrangling
We had a snow day for this class. Here is a short video tutorial to help you get started and complete the assignment for this week. We will go over everything here next class as well.
Overview
Loading Data into R
Data formatting (dataframes and data.tables)
Introduction to the dplyr package for filtering, selecting, augmenting, and summarizing data sets (and more).
Your Rmarkdown Assignment This links to the .rmd file, that you can use as a template to complete the assignment. Using this template file, create a new page on your website, and submit the link
Answer sheet for assignment You can use this to check your work. If you don’t get the same numbers, then one of us did something wrong.
Due date: M Mar 18th
6. Common inferential tests
Overview
t-tests, anovas, and linear regresssion, and more in R
Using R to simulate null-hypotheses
Overview and discussion of midterm project (three parts due over the next three weeks)
Introduction to creating reproducible APA manuscripts using the papaja package. Students learn how to use the template for writing an APA report in R Markdown, which allows them to embed their R-scripts for data-analysis into the manuscript, allowing others to reproduce their analysis.
Make a R shiny app (it can do whatever you want to make).
Host the app as a folder on Github, or upload to shinyapps.io cloud server (need to create free account).
Submit link on Blackboard
Due date: M Apr 15th
10. Optimizing R scripts
Overview
Principles of scripting for efficient memory management, including using profiles packages for determining which parts of a script can be further optimized. Discussion of vectorization in R.