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.
100.1 + 234.9 + 12.01
What is the output?
-> 347.01
sqrt(256)
## [1] 16
What is the output?
-> 16
log10(100)
## [1] 2
What is the output?
-> 2
x <- 10
# ASSIGN NUMBER 20 TO OBJECT y BY TYPING 20 AFTER <-
y <- 20
x * y
## [1] 200
What is the output?
-> 200
z <- x * y
z
## [1] 200
What is the output?
-> 200
What is the output? How many objects are there in the environment?
-> “x” “y” “z” 3 objects
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
-> 10
-> 200
-> 3
Clear environment by using following code:
rm(list = ls())
-> character(0)