Assignment 1: Haley White
fluoride<-read.csv(url("http://jamessuleiman.com/teaching/datasets/fluoride.csv"),
stringsAsFactors = FALSE)
arsenic<-read.csv(url("http://jamessuleiman.com/teaching/datasets/arsenic.csv"),
stringsAsFactors = FALSE)
arsenic_noNA<-arsenic %>%
filter(!is.na(percent_wells_above_guideline))
fluoride_noNA<-fluoride %>%
filter(!is.na(percent_wells_above_guideline))
new_arsenic<-arsenic_noNA %>%
select(location, percent_wells_above_guideline)
new_fluoride<-fluoride_noNA %>%
select(location, percent_wells_above_guideline)
Tibble
ilo_data<-new_arsenic %>%
inner_join(new_fluoride, by=c("location"))
ilo_data$percentage<-ilo_data$percent_wells_above_guideline.x + ilo_data$percent_wells_above_guideline.y
merged_data <- ilo_data %>% select(location, percentage) %>% top_n(5) %>%
arrange(desc(percentage))
## Selecting by percentage
as_tibble(merged_data)
## # A tibble: 5 x 2
## location percentage
## <chr> <dbl>
## 1 Otis 69.6
## 2 Manchester 62.2
## 3 Surry 58.6
## 4 Monmouth 52.6
## 5 Blue Hill 52.3
Table
library(pander)
panderOptions('round',2)
set.caption("Maine Towns with Highest Percentage of Wells Above Arsenic and Fluoride Levels")
pander(merged_data)
Maine Towns with Highest Percentage of Wells Above Arsenic and Fluoride Levels
| Otis |
69.6 |
| Manchester |
62.2 |
| Surry |
58.6 |
| Monmouth |
52.6 |
| Blue Hill |
52.3 |
Chart

Narrative
- Things I found interesting:
- Over half of the wells in the top 5 towns (featured on chart) in Maine are above the levels of arsenic or fluoride.
- Joining the data and creating the tibble was difficult, but I found it easy to turn the tibble into a table and chart.
- Issues I had:
- Coming up with a narrative from so much data was overwhelming.
- Figuring out the code for how to effectively join the data was difficult.