This is not a real lab. This is a practice lab. It serves two purposes:

  1. To help you get into the rhythm of the course.
  2. For you to practice lab submission. The “due date” only exists for practice purposes.

Directions

For this lab, you will create a single .R file called lab00.R. The following exercises will ask you to write code. Place all requested code in this .R file separated by comments which indicate which code corresponds to which exercise.

Note: A comment in R begins with a #. For example:

# this line is a comment, the following line is real code
print("This is code that will run!")

Copy-paste the above code into an R console. You’ll find that the first line has no effect (because it was commented) while the second line will create output.

Submit your lab to the corresponding assignment on Canvas. We will “grade” your lab as a way of letting you know that you have submitted a lab that matches our expectations. You have unlimited attempts before the deadline. Your final submission before the deadline will be graded.


Grading

This lab is not graded. However, this section exists to show that in general, we will provide information on how each individual lab is graded.


Exercise 1 (Hello World!)

It is tradition when learning a new programming language for the first program you write to be something called “Hello World.” That is, your task is to write code which returns Hello World!.

In R, the code to accomplish this task is:

print("Hello World!")

Place this code in your .R file for this exercise. Also, run the code!


Exercise 2 (Another Exercise)

Write R code that does the following: