Created
November 8, 2019 15:12
-
-
Save hepplerj/44dda3ec78d804f5b7b4a13905a7a7b7 to your computer and use it in GitHub Desktop.
Checking points and filtering incorrect or unneeded data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(maps) | |
library(mapdata) | |
data <- read_csv("~/Desktop/nplsuperfund.csv") | |
names(data) <- c("lat","lon","date") | |
# Filter down to USA extent to remove extraneous points | |
tidy <- data %>% | |
filter(lat < -67, lat > -125) %>% | |
filter(lon > 25, lon < 50) | |
# Basemap | |
usa <- map_data("usa") | |
# Check data with a plot | |
ggplot() + | |
geom_polygon(data = usa, aes(x=long, y = lat, group = group)) + | |
geom_point(data = tidy, aes(x = lat, y = lon), color = "red") + | |
coord_fixed(1.3) | |
write_csv(tidy, "tidy.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment