==============================================================================

R Studio setup in class work

==============================================================================

1. The sum of 100.1, 234.9 and 12.01

100.1 + 234.9 + 12.01 # -> Output: 347.01

2. The square root of 256

sqrt(256) # -> Output: 16

3. Calculate the 10-based logarithm of 100.

log10(100) # -> Output: 2

4. Assign number 10 to object x and number 20 to object y.

x <- 10 y <- 20

5. Calculate the product of x and y

x * y # -> Output: 200

6. Store the result in a new object called z

z <- x * y z # -> Output: 200

7. Inspect your environment by typing ls()

ls() # -> Output: [1] “x” “y” “z” # -> How many objects are there? There are 3 objects in the environment.

8. Make a vector of the objects x, y and z.

myvec <- c(x, y, z) myvec # -> Output: 10 20 200

Run commands to find min, max, and length of the vector

min(myvec) # 9. What is the minimum of myvec? -> Output: 10 max(myvec) # 10. What is the maximum of myvec? -> Output: 200 length(myvec) # 11. What is the length of myvec? -> Output: 3

Clear environment by using following code:

rm(list = ls())

12. Is there anything in your environment now?

ls() # -> Output: character(0) # -> Meaning: No, the environment is empty.