Title: Poverty and Pollution in the Bay Area
Subtitle: A dashboard for PHW251B students
Data source: calenviroscreen40resultsdatadictionary.xlsx
Background: The data for this analysis comes from the California Office of Environmental Health Hazards. It provides a comprehensive summary of various forms of pollution in different locations across the state of California. In the present analysis, we explore the relationship between pollution and poverty. This is an essential questions because it is at the core of environmental justice and health equity.
Results: The present analysis demonstrates that pollution and poverty are highly correlated in the state of California as a whole. As poverty level increases, as does pollution. This relationship is upheld when we look more closely at 4 counties in the San Francisco Bay area in which the percent of persons in poverty follows a very similar trends to the distribution of pollution on the county level.
The line above adds a second page under a new tab! Let’s visualize the dataset as an interactive table for viewers to explore:
datatable(grouped_data,
#add CSS class for theming
class = 'cell-border stripe',
#custom column name
colnames = c("County", "Population", "Pollution Burden", "Asthma", "Education", "Poverty"),
#remove numbered index
rownames = F,
#add buttons to export the data within the html (cool!)
#note that the `dom` argument can accept many, check out documentation for more
#by calling `Btp`, we keep buttons (B), the table itself (t), and pagination control (p)
extensions = 'Buttons', options = list(dom = 'Btpl',
buttons = c('copy',
'csv',
'excel',
'pdf',
'print'),
#how many entries per page
pageLength = 10,
#options for "Show how many entries"
lengthMenu = c(10, 20, 30)),
height = "fit-content") %>%
#bold the `city_ascii` column
formatStyle("California.County", fontWeight = "bold")
And that’s the end of this module – in essence, it’s just a new way to organize and use an RMD to output a different product. And there are many more customizations and additional arguments that can further enhance your dashboard product, so be sure to take a look at the assigned chapter to learn about the possibilities! The final step is to click “Knit to flex_dashboard”. This will give you an HTML document that you can share with others.