D Exercise 02

Last updated: 2020-09-28 17:50:13

D.1 Question 1

  • Run the following four expressions to load two vectors named year and co2 into memory
  • The co2 vector contains \(CO_2\) measurements in the atmosphere, in ppm units, during the period 1959-1997. The year vector contains the corresponding years.
  • Calculate a vector of \(CO_2\) differences between consecutive years, that is:
    • \(CO_2\) in 1960 minus \(CO_2\) in 1959
    • \(CO_2\) in 1961 minus \(CO_2\) in 1960
    • and so on…
  • Create a plot (Figure D.1) with lines and points showing the consecutive \(CO_2\) differences as function of time (1960, 1961, etc.)
  • The difference in \(CO_2\) concentration between 2020 and 2019 was equal to 2.64. Add a point in red representing that difference to your plot (use a different point shape, such as pch=4).
$CO_2$ over time

Figure D.1: \(CO_2\) over time

(50 points)

D.2 Question 2

  • Read the rainfall.csv file into a data.frame object
  • Find and print the station names where all nine months are with <10 mm of rainfall
## [1] "Yotveta" "Eilat"
  • Note: you can define the vector m with month names in your code to subset the columns with monthly rainfall amounts, as shown in Section 4.4.3.

(50 points)