Due: January 19 by 11:59pm

Submit: To submit this assignment, create a zip file of all the files in your R project folder for this assignment. Name the zip file hw1-netID.zip, replacing netID with your netID (e.g., hw1-jph.zip). Use this link to submit your file.

Weight: This assignment is worth 5% of your final grade.

Purpose: The purposes of this assignment are to:

Skills & Knowledge: After completing these exercises, you should:

Assessment: Each question indicates the % of the assignment grade, summing to 100%. The credit for each question will be assigned as follows:

The reflection portion is always worth 10% and graded for completion.

Rules:

1) Class setup [SOLO, 10%]

For this class, you’ll need to install some software and register for some tools. You should have already done this, but in case you haven’t,go to the course software page to get setup.

Once you have joined the class slack, make a post to the #welcome channel introducing yourself - provide your name, year / program, and something interesting about yourself.

2) Getting familiar with the course [SOLO, 10%]

Follow Snoop’s advice and read the entire Course Syllabus (actually read the whole thing). Then review the schedule and make sure to note important upcoming deadlines.

3) Staying organized [SOLO, 10%]

Open RStudio and create a new R project called “hw1” (see the reading for details on how to do this). Within your project, create a new R script (a “.R” file) and save it as “hw1-netID.R”, replacing “netID” with your netID (e.g., “hw1-jph.R”). When you save it, it should show up in the R project folder you just created. Finally, copy the following code to the top of this script and fill out your name, netID, and the names of anyone you worked with on this assignment (your netID is the part of your email address before "@gwu.edu"):

# Name:  Last, First
# netID: Insert your netID here

# I worked with the following classmates on this assignment:
# 1) Name: Last, First
# 2) Name: Last, First

Write your responses to all other questions in this assignment in your R file.

4) Objects & Operators: Converting Time [COLLABORATIVE, 20%]

Create objects to store each of the following two values - be sure to use meaningful variable names when creating your objects:

Now, say you have another object called time_in_seconds that contains an integer number of seconds (for example, time_in_seconds <- 8675309). Write code to convert the value stored in time_in_seconds into the units described below. Your solution may only use arithmetic operators and the objects you created (i.e. you may not use any numbers). You may also use the new objects you create in sequential order. For example, you may use the object created in part a) to create the object in part b), and so on.

  1. The value of time_in_seconds in minutes
  2. The value of time_in_seconds in hours
  3. The value of time_in_seconds in days
  4. The value of time_in_seconds in years

5) Logical and relational operators [SOLO, 20%]

Consider the following objects:

w <- FALSE
x <- TRUE
y <- FALSE
z <- TRUE

Write code to answer the following questions:

  1. Write a statement with logical operators that compares the objects x, y, and z and returns TRUE
  2. Write a statement with logical operators that compares the objects x, y, and z and returns FALSE
  3. Fill in relational operators to make the following statement return TRUE:

! (x __ y) & ! (z __ y)

  1. Fill in relational operators to make this statement return FALSE:

! (w __ y) | (z __ y)

6) Data types [COLLABORATIVE, 20%]

Consider the following objects:

number    <- typeof('3')
character <- typeof(7)
false     <- typeof("FALSE")
true      <- typeof(TRUE)

Write code to answer the following questions:

  1. Write a statement with both relational & logical operators that compares the four objects number, character, false, and true and returns TRUE.
  2. Write a statement with both relational & logical operators that compares the four objects number, character, false, and true and returns FALSE.

7) Read and reflect [SOLO, 10%]

Read and reflect on next week’s readings on functions & packages. Afterwards, in a comment (#) in your R file, write a short reflection on what you’ve learned and any questions or points of confusion you have about what we’ve covered thus far. This can just few a few sentences related to this assignment, next week’s readings, things going on in the world that remind you something from class, etc. If there’s anything that jumped out at you, write it down.

In case you missed them, instructions for how to submit your assignment are at the top of this page.


EMSE 4571: Intro to Programming for Analytics (Spring 2022)
Thursdays | 12:45 - 3:15 PM EST | Tompkins 208 | Dr. John Paul Helveston | jph@gwu.edu
LICENSE: CC-BY-SA