Data cleaning step 3
Removing records with coordinate uncertainty and precision issues
clean_step3 <- clean_step2 %>%
filter(is.na(coordinateuncertaintyinmeters) |
coordinateuncertaintyinmeters < 10000,
is.na(coordinateprecision) |
coordinateprecision > 0.01)
print(paste0(nrow(gbif_download)-nrow(clean_step3), " records deleted; ",
nrow(clean_step3), " records remaining." ))
Plotting raw records vs. cleaned records (step 3)
ggplot() +
geom_sf(data = country_map) +
geom_point(data = gbif_download,
aes(x = decimallongitude,
y = decimallatitude),
shape = "+",
color = "black") +
geom_point(data = clean_step3,
aes(x = decimallongitude,
y = decimallatitude),
shape = "+",
color = "red") +
coord_sf(xlim = st_bbox(country_map)[c(1,3)],
ylim = st_bbox(country_map)[c(2,4)]) +
theme_bw()
Oh no! we only have 14 records left.