You return to your government job of the previous lab. As is often the case, however, the publisher of
data has switched formats! Your manager comes to you with a set of requests related to those of exercise 1
from the previous lab, however this time you will need to conduct your analysis on the usstates.json le
(instead of the .csv le). Predictably, the JSON le does not load as nicely into a data.frame as the .csv le
Complete the following tasks:
b. Given the variable state containing a 2-letter abbreviation, store the full name of the state in
a variable named full_name.
c. (Given the variable state (same as part b), store the population density of that state in a variable
Here is my code that isn't working:
state <- "TX"
full_name <- as.character(m$state[["name"]])
population <- as.numeric(m$state[["pop"]])
area <- as.numeric(m$state[["area"]])
pop_density <- population / area