Appendix A — Exercise 2 solutions

A.1 Question 1

Add your name and the date to the top of your script file (hint: comment this out so R does not try to run it)

Solution

  1. Add a # at the beginning of the row, followed by your name and the date, for example:
# Sophie 18/11/2024

A.2 Question 2

Use R to answer to following sums:

  1. \(64^2\)

  2. \(3432 \div 8\)

  3. \(96 \times 72\)

For each part of question 2, copy the result from the console and paste them onto the same line of the script file as the code. Do this in a way that ensures there are no error messages if you were to run the entire script file.

Solution

For each calculation, copy the result from the console and paste it in the script file after a # symbol:

64^2   # 4092

3432 / 8  # 429

96 * 72  # 6912