Files flouride.csv and arsenic.csv were downloaded from the Maine Tracking Network and contain fluoride and arsenic levels, by town, for private well water samples tested by the State of Maine Health and Environmental Testing Laboratory (HETL) between the years 1999 and 2013.
For locations with fewer than 20 wells tested, only the number of wells tested and the maximum value are displayed. All test results reported as less than the laboratory’s limit of detection were replaced with a value that is one-half of the detection limit.
The State of Maine Health and Environmental Testing Laboratory provided these data. The table was prepared by the Maine Environmental Public Health Tracking Program. The complete data set contains water test results from 46,855 private wells in Maine. Revision Date: 08/2015.
Unit abbreviations are:
Maine’s Maximum Exposure Guidelines:
# Read Data Files
arsenic <- read.csv("arsenic.csv", header = TRUE, stringsAsFactors = FALSE)
flouride <- read.csv("flouride.csv", header = TRUE, stringsAsFactors = FALSE)
# Check the field headings for table: arsenic
names(arsenic)
## [1] "location" "n_wells_tested"
## [3] "percent_wells_above_guideline" "median"
## [5] "percentile_95" "maximum"
# Check the field headings for table: flouride
names(flouride)
## [1] "location" "n_wells_tested"
## [3] "percent_wells_above_guideline" "median"
## [5] "percentile_95" "maximum"
library(ggvis)
library(knitr)
library(tidyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
Renaming the field headings to allow for table joining.
# Create the new data frame: arsenic_level
# Rename Field Headings
arsenic_level <- arsenic %>% rename(arsenic_tests = n_wells_tested) %>% rename(arsenic_percent_above = percent_wells_above_guideline) %>% rename(arsenic_median = median) %>% rename(arsenic_95th_percentile = percentile_95) %>% rename(arsenic_max = maximum)
# Create the new data frame: flouride_level
# Rename Field Headings
flouride_level <- flouride %>% rename(flouride_tests = n_wells_tested) %>% rename(flouride_percent_above = percent_wells_above_guideline) %>% rename(flouride_median = median) %>% rename(flouride_95th_percentile = percentile_95) %>% rename(flouride_max = maximum)
# Check the field headings for table: arsenic_level
names(arsenic_level)
## [1] "location" "arsenic_tests"
## [3] "arsenic_percent_above" "arsenic_median"
## [5] "arsenic_95th_percentile" "arsenic_max"
# Check the field headings for table: flouride_level
names(flouride_level)
## [1] "location" "flouride_tests"
## [3] "flouride_percent_above" "flouride_median"
## [5] "flouride_95th_percentile" "flouride_max"
# Create the new data frame: ex_arsenic_level
# Query locations with median readings that exceed Maine's Maximum Exposure Guideline
ex_arsenic_level <- arsenic_level %>% select(location, arsenic_tests, arsenic_median) %>% filter(arsenic_median >= 10) %>% arrange(location)
# Create the new data frame: ex_flouride_level
# Query locations with median readings that exceed Maine's Maximum Exposure Guideline
ex_flouride_level <- flouride_level %>% select(location, flouride_tests, flouride_median) %>% filter(flouride_median >= 2) %>% arrange(location)
# Create the new data frame: lg_arsenic_level
# Query locations 275 or more wells tested
lg_arsenic_level <- arsenic_level %>% select(location, arsenic_tests, arsenic_percent_above, arsenic_median) %>% filter(arsenic_tests >= 275) %>% arrange (location)
# Create the new data frame: lg_arsenic_level
# Query locations 275 or more wells tested
lg_flouride_level <- flouride_level %>% select(location, flouride_tests, flouride_percent_above, flouride_median) %>% filter(flouride_tests >= 275) %>% arrange(location)
# Join tables lg_arsenic_level and lg_arsenic_level by location
combined <- inner_join(lg_arsenic_level, lg_flouride_level, by="location") %>% arrange(desc(arsenic_percent_above))
kable(lg_arsenic_level)
| location | arsenic_tests | arsenic_percent_above | arsenic_median |
|---|---|---|---|
| Augusta | 454 | 26.4 | 4.00 |
| Belgrade | 401 | 31.2 | 5.25 |
| Buxton | 334 | 43.4 | 6.00 |
| Ellsworth | 428 | 29.7 | 3.60 |
| Gardiner | 279 | 20.1 | 2.00 |
| Gorham | 467 | 50.1 | 10.50 |
| Harpswell | 300 | 5.3 | 0.50 |
| Manchester | 275 | 58.9 | 14.00 |
| Monmouth | 277 | 49.5 | 10.00 |
| Readfield | 344 | 39.8 | 7.20 |
| Sidney | 287 | 26.8 | 3.85 |
| Standish | 632 | 26.9 | 2.00 |
| Winthrop | 424 | 44.8 | 8.20 |
kable(lg_flouride_level)
| location | flouride_tests | flouride_percent_above | flouride_median |
|---|---|---|---|
| Augusta | 479 | 1.9 | 0.20 |
| Belgrade | 417 | 5.5 | 0.32 |
| Brunswick | 299 | 5.0 | 0.10 |
| Buxton | 383 | 1.0 | 0.10 |
| Ellsworth | 503 | 9.3 | 0.50 |
| Freeport | 278 | 0.4 | 0.10 |
| Gardiner | 299 | 1.3 | 0.20 |
| Gorham | 452 | 0.0 | 0.10 |
| Harpswell | 318 | 0.9 | 0.10 |
| Manchester | 276 | 3.3 | 0.30 |
| Monmouth | 288 | 3.1 | 0.30 |
| Readfield | 351 | 2.8 | 0.30 |
| Sidney | 312 | 1.6 | 0.20 |
| Standish | 290 | 1.7 | 0.10 |
| Windham | 282 | 0.7 | 0.10 |
| Winthrop | 453 | 3.1 | 0.31 |
kable(combined)
| location | arsenic_tests | arsenic_percent_above | arsenic_median | flouride_tests | flouride_percent_above | flouride_median |
|---|---|---|---|---|---|---|
| Manchester | 275 | 58.9 | 14.00 | 276 | 3.3 | 0.30 |
| Gorham | 467 | 50.1 | 10.50 | 452 | 0.0 | 0.10 |
| Monmouth | 277 | 49.5 | 10.00 | 288 | 3.1 | 0.30 |
| Winthrop | 424 | 44.8 | 8.20 | 453 | 3.1 | 0.31 |
| Buxton | 334 | 43.4 | 6.00 | 383 | 1.0 | 0.10 |
| Readfield | 344 | 39.8 | 7.20 | 351 | 2.8 | 0.30 |
| Belgrade | 401 | 31.2 | 5.25 | 417 | 5.5 | 0.32 |
| Ellsworth | 428 | 29.7 | 3.60 | 503 | 9.3 | 0.50 |
| Standish | 632 | 26.9 | 2.00 | 290 | 1.7 | 0.10 |
| Sidney | 287 | 26.8 | 3.85 | 312 | 1.6 | 0.20 |
| Augusta | 454 | 26.4 | 4.00 | 479 | 1.9 | 0.20 |
| Gardiner | 279 | 20.1 | 2.00 | 299 | 1.3 | 0.20 |
| Harpswell | 300 | 5.3 | 0.50 | 318 | 0.9 | 0.10 |
kable(ex_arsenic_level)
| location | arsenic_tests | arsenic_median |
|---|---|---|
| Gorham | 467 | 10.5 |
| Manchester | 275 | 14.0 |
| Monmouth | 277 | 10.0 |
No locations found
combined %>% ggvis(~arsenic_percent_above, ~flouride_percent_above) %>% layer_points()