7.4 Exercice 1. Getting started.
Create the script “exercise1.R” (in R Studio: File -> New File) and save it to the “Rcourse/Module1” directory: you will save all the commands of exercise 1 in that script.
Remember you can comment the code using #.
1- From the terminal, go to Rcourse/Module1. First check where you currently are with getwd(); then go to Rcourse/Module1 with setwd()
2- Using R as a calculator, calculate the square root of 654.
3- Using R as a calculator, calculate the percentage of males and females currently present in the classroom.
correction
## [1] 31.57895
## [1] 68.42105
4- Create a new object “myobject” with value 60. Show “myobject” in the terminal.
5- Reassign myobject with value 87.
correction
6- Subtract 1 to myobject. Reassign.
correction
7- Create a new object “mysqrt” that will store the square root of “myobject”.
correction
8- Create a new object “mydiv” that will store the result of “myobject” divided by “mysqrt”.
correction