C Exercise 01

Last updated: 2020-08-12 00:41:46

C.1 Question 1

  • On R start-up, several sample datasets are loaded
  • Two of them are:
    • state.name - Names of US states
    • state.area - Corresponding state area size, in square Miles
  • Create a vector of state area sizes in square kilometers
  • Print a subset of state names for states whose areas are smaller than 10,000 square kilometers
  • Note: you need to convert from square miles to square kilometers
## [1] "Delaware"     "Rhode Island"

(50 points)

C.2 Question 2

  • Use the state.name and state.area vectors and write an expression that prints the name of the state which has the largest area in the US
  • Note: do not use the values 2 or "Alaska" in your the expression!
## [1] "Alaska"

(50 points)