Data cleaning step 1
With each step note the number of records that you are removing
Removing data recorded based on fossil or living specimens, and records from alien/invasive populations
clean_step1 <- gbif_download %>%
as_tibble() %>%
filter(!basisofrecord %in% c("FOSSIL_SPECIMEN",
"LIVING_SPECIMEN"),
!establishmentmeans %in% c("MANAGED",
"INTRODUCED",
"INVASIVE",
"NATURALISED"))
print(paste0(nrow(gbif_download)-nrow(clean_step1), " records deleted; ",
nrow(clean_step1), " records remaining."))
Plotting raw records vs. cleaned records (step 1)
ggplot() +
geom_sf(data = world_map) +
geom_point(data = gbif_download,
aes(x = decimallongitude,
y = decimallatitude),
shape = "+",
color = "black") +
geom_point(data = clean_step1,
aes(x = decimallongitude,
y = decimallatitude),
shape = "+",
color = "red") +
theme_bw()
