In this R markdown document, you should answer each question and click the knit button to generate a pdf or HTML or word document, which should be submitted into D2L.

Type answers after the -> sign.

First, we will calculate the following quantities.

  1. The sum of 100.1, 234.9 and 12.01
100.1 + 234.9 + 12.01

What is the output?

-> 347.01

  1. The square root of 256
sqrt(256)
## [1] 16

What is the output?

-> 16

  1. Calculate the 10-based logarithm of 100. Hint: see ?log.
log10(100)
## [1] 2

What is the output?

-> 2

  1. Assign number 10 to object x and number 20 to object y.
x <- 10
# ASSIGN NUMBER 20 TO OBJECT y BY TYPING 20 AFTER <-
y <- 20
  1. Calculate the product of x and y
x * y
## [1] 200

What is the output?

-> 200

  1. Store the result in a new object called z
z <- x * y
z
## [1] 200

What is the output?

-> 200

  1. Inspect your environment by typing ls() in the console (left bottom panel), and press enter or check environment panel.

What is the output? How many objects are there in the environment?

-> “x” “y” “z” 3 objects

  1. Make a vector of the objects x, y and z. Use this command,
myvec <- c(x,y,z)
myvec
## [1]  10  20 200

What is the output?

-> 10 20 200

min(myvec) # minimum
## [1] 10
max(myvec)  # maximum
## [1] 200
length(myvec) # length
## [1] 3
  1. What is the minimum of myvec.

-> 10

  1. What is the maximum of myvec.

-> 200

  1. What is the length of myvec.

-> 3

Clear environment by using following code:

rm(list = ls())
  1. Is there anything in your environment now? (Check Environment panel or type ls() in the console, if you see character(0), it means no objects stored in the environment).

-> character(0)

Change the author name in the YAML to your name, save your file, knit it as an PDF or HTML or word document, change the knitted document’s name to ‘Filename_yourname’ and then submit it to the D2L assignment folder.