Week 1 Slide Decks

Overview

This week we’ll be covering mostly big picture background content. We’ll begin with background on data science generally then narrow to talking about why this course is taught in R (rather than some other coding language). I’ll then give you some hard-won tips on problem solving so that you can begin to develop strategies for handling the errors and warnings that you’ll inevitably encounter as you grow your competency in this arena. In lab, we’ll discuss some crucial components of navigating and using RStudio as well as begin our conversation about R scripts and “base R”

Lecture 1 - Data Science Fundamentals

Lecture Slides – Full Screen

Lab 1 - RStudio & Base R

Lab Slides – Full Screen

Homework 1

Learning Objective(s)

Upon completion of these assignments, students will be able to:

  • Describe a real-world file path
  • Demonstrate comfortability with using comments in an R script
  • Explain fundamental principles of R and RStudio
  • Perform arithmetic using objects in R
  • Manipulate and interpret vectors and objects of various classes and contents

Assignment Due Date(s)

Each homework is due at midnight the day before each lecture (i.e., Monday night) Late work will be accepted but will be subject to the late assignments policy outlined in this course’s syllabus.

Assignment Description

This homework should be submitted as an R script with your last name and week 1 as the file name (e.g., “Lyon_week1.R”). Remember to include comments explaining what line(s) correspond to each of the following prompts.

  1. As a comment, write the full file path on your computer to where you’ve saved this script. Folders should be separated by slashes. Include the name of the R script in the file path

  2. As a comment, explain the difference between the RStudio “Console” and “Source” panes

  3. As a comment, describe–in your own words–what is meant by the term “base R”

  4. Create an object named “weight_kg” and assign the value 62 as a number

  5. Create a new object by multiplying the ‘weight_kg’ object by 2.2 and assign the result to an object called “weight_lb”

  6. As a comment, define both (A) the value of ‘weight_lb’ and (B) the class of ‘weight_lb’

  7. Write the code necessary to access the help file for the function floor

  8. As a comment, define the argument(s) that the floor function accepts beneath your response to #7

    • NOTE: this should include both (A) the name of the argument and (B) what class(es) the argument requires
  9. Concatenate the following values into an object called “my_vector”: 4, 8, 15, 23, “hello”, “world”

  10. Provide code to identify (A) the length of ‘my_vector’, (B) the class of my vector, and (C) what happens if you try to take the square root of ‘my_vector’

    • NOTE: For part C, explain why that outcome occurs when you attempt to take the square root of ‘my_vector’