Create an RMarkdown file to use for this assignment. Use html as the output and change at least one option in the yaml. Complete the rest of the assignment using markdown and chunks to create readable code and output.
Part 2
Using censusreporter.org, pick an American Community Survey variable and a geographic area and division (e.g. nationwide and states, statewide and county, county and tracts).
Using tigris, tidycensus, and leaflet (encouraged, or your favorite R package for maps), map the variable over your chosen geographic divisions. Select an appropriate pallete, and consider adding popup labels. Write a few sentences describing your map in Markdown
divvy202307_sf %>%st_drop_geometry() %>%mutate(day =wday(started_at, label =TRUE)) %>%ggplot() +geom_bar(aes(day, fill = rideable_type)) +labs(x ='Day of the Week',y ='Rides',title ='Divvy Trips by Day of the Week - July 2023') +scale_fill_discrete(name ="Ride Type",labels =c("Classic", "Docked", "Electric"))
Code
divvy202307_sf %>%st_drop_geometry() %>%mutate(day =wday(started_at, label =TRUE)) %>%mutate(hour =hour(started_at)) %>%ggplot() +geom_bar(aes(hour, fill = rideable_type)) +labs(x ='Hour',y ='Rides',title ='Divvy Trips by Hour for Each Day of the Week - July 2023') +scale_fill_discrete(name ="Ride Type",labels =c("Classic", "Docked", "Electric")) +facet_grid(rows =vars(day))
Part 4
Grab another variable for the same geographic area and divisions with the intent of exploring correlation between this variable and the one selected in the part 2. Replicate some of the analysis from Tidy Modeling Sec 3.1.
Code
acs_il20 %>%filter(str_starts(GEOID, "17031")) %>%mutate(white_nh_pct = estimate_white_nh / estimate_totalpop) %>%ggplot(aes(x = white_nh_pct, y = estimate_medincome)) +geom_point(alpha=.2) +geom_smooth(method = lm) +theme_bw() +scale_y_continuous(labels = scales::dollar_format()) +scale_x_continuous(labels = scales::percent_format()) +labs(x='Percent White Non-Hispanic', y='Median Income', title='Median Income and Percent White Non-Hispanic by Census Tract \nin Cook County')