C Exercise 01
Last updated: 2021-03-31 00:29:17
C.1 Question 1
- On R start-up, several sample datasets are loaded
- Two of them are:
state.name
—Names of US statesstate.area
—Corresponding state area size, in \(mi^2\) (square miles)
- Create a vector of state area sizes in \(km^2\)
- Print a subset of state names for states whose areas are greater than 300,000 \(km^2\) and smaller than 700,000 \(km^2\)
- Note: you need to convert from \(mi^2\) to \(km^2\)!
## [1] "California" "Montana" "New Mexico" "Texas"
(50 points)
C.2 Question 2
- Use the
state.name
andstate.area
vectors and write an expression that prints the name of the state which has the smallest area in the US - Note: do not use the specific values
39
or"Rhode Island"
in your code!
## [1] "Rhode Island"
(50 points)