Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PSYC-560 R Assignments using R Script

PSYC-560 R Assignments using R Script

Here's how to set up your R Studio Project by adding the first R script in a folder for CLU PSYC 560 Exploratory Data Analysis and Visualization.

More Decks by Jamie D. Bedics, PHD, ABPP

Other Decks in Education

Transcript

  1. Class Assignments • In this presentation, you will: 1. Create

    folders in your R Project 2. Add R Script to your folder for homework. The presentation assumes you already setup your R Project for your course and you opened it and are working in it
  2. 1. Save it right away 3. Add `hw2-bedics` which is

    for Homework #2 4. Add your name at the end of all your material to help the instructor (we need to know who it belongs to when you turn it in!) 2. Save it the HW folder
  3. Use # in your code: 1. The “#” allows you

    to type notes to yourself. It’s a way of commenting to yourself and also to anyone reviewing your code (like your instructor). 2. You only need one # to make a comment 4. You can use a lot of “#” to add structure to the document like what was done above 5. I recommend to use “#” and make comments profusely. The more you tell yourself what you’re doing the better.
  4. Load necessary libraries at the top of the script 1.

    Always load your libraries at the top of the script 2. tidyverse is a package that we will use a lot. 3. By calling “library(tidyverse)” we are opening the library which assumes it has already been installed in the console using: install.packages(“tidyverse”)
  5. Add four #### at the end of a major section

    • This will help organize your code so you can jump to places. • Like a table of contents • Sometimes our code can be very long
  6. Check this page out for more tips on running your

    data project https://kkulma.github.io/2018-03-18-Prime-Hints-for-Running-a-data-project-in-R/