As this is the first set exercises in this course, it is quite easy and short. Its purpose is also to get used to this exercise format and, more importantly, to get a first feeling for working with R and RStudio.

Note: You can find the solutions for this exercise as well as all other exercises in the solutions folder in the repo/directory that contains the course materials. You can easily copy code from these solution files by clicking on the small blue clipboard icon in the upper right corner of the solution boxes showing the code.

1

The first thing we would like you to do in this exercise is to explore the RStudio interface a bit. Just “have a look around” and see, if you can find the elements and options we have discussed so far.

For the following simple coding tasks in this first set of exercises, you can just work interactively in the Console in R/RStudio.

2

After you have made yourself a bit familiar with the RStudio interface, start using the console interactively by entering and executing the following simple calculations: 21 times 2; 2 to the power of 6; 1 divided by 3

Feel free to play around a bit and try a few things out.

3

Now, let’s create an object in R. Assign the number 42 to an object named the_answer and then print the object to the console.
You need to use the assignment operator <- for this.

Also have a look at the Environment tab in the RStudio interface. The object you created should now be visible there.

4

Use a simple function to calculate the square root of 49.

5

Check out the help file for the grep() function. How many required arguments does it have?