Question

You return to your government job of the previous lab. As is often the case, however, the publisher of the

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

did.

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

named pop_density.


Here is my code that isn't working:

#2.b

state <- "TX"

full_name <- as.character(m$state[["name"]])


#2.c

population <- as.numeric(m$state[["pop"]])

area <- as.numeric(m$state[["area"]])

pop_density <- population / area

You return to your government job of the previous lab. As is often the case, however, the publisher of the data has switched formats! Your manager...
Get unstuck

338,976 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses