Watts-College / cpp-529-spr-2022

https://watts-college.github.io/cpp-529-spr-2022/
0 stars 2 forks source link

Lab 02 Data Exploration and Plotting US Map #4

Open jmacost5 opened 2 years ago

jmacost5 commented 2 years ago

county_pov <- get_acs(geography = "county", HouseValue=="B25077_001", HHIncome=="B19013_001", year = 2017, survey = "acs5", geometry = TRUE, shift_geo = TRUE) %>% mutate(HHInc_HousePrice_Ratio=round(HouseValue/HHIncome,2)) ggplot(country_pov) + geom_sf(aes(fill = HHInc_HousePrice_Ratio), color=NA) + coord_sf(datum=NA) + labs(title = "House Value Over House Income", subtitle = "Alaska and Hawaii are shifted and not to scale", caption = "Source: ACS 5-year, 2017", fill = "HHInc_HousePrice_Ratio") + scale_fill_viridis(direction=-1) Error in get_acs(geography = "county", HouseValue == "B25077_001", HHIncome == : object 'HHIncome' not found

arrange( CenDF, desc(HHInc_HousePrice_Ratio) ) Error in st_as_sf(): ! Problem with the implicit transmute() step. x Problem while computing ..1 = HHInc_HousePrice_Ratio. x ..1 must be size 6440 or 1, not 2. Backtrace:

  1. dplyr::arrange(CenDF, desc(HHInc_HousePrice_Ratio))
  2. dplyr:::arrange.data.frame(CenDF, desc(HHInc_HousePrice_Ratio)) Error in st_as_sf(NextMethod(), sf_column_name = attr(.data, "sf_column")) : x Problem while computing ..1 = HHInc_HousePrice_Ratio. x ..1 must be size 6440 or 1, not 2.