Load tables
library(readxl)
library(raster)
library(sf)
library(tidyverse)
library(mapview)
DB_camera_trap <- read_excel("D:/BoxFiles/Box Sync/CodigoR/Toshiba/Mammals/data/DCore_Fototrampeo_V.6_7-feb-2021- GP MP MP_DL.xlsx",
sheet = "Plantilla")
DB_colecciones <- read_excel("C:/Users/usuario/Desktop/SCMas/DCore_Cat_Esp_Ame_Colecciones_7-feb-de 2021-GP-DM.xlsx",
sheet = "Plantilla")
DB_colecciones$decimalLongitude <- as.numeric(DB_colecciones$decimalLongitude)
DB_colecciones$decimalLatitude <- as.numeric(DB_colecciones$decimalLatitude)
DB_camera_trap$decimalLatitude <- as.numeric(DB_camera_trap$decimalLatitude)
DB_camera_trap$decimalLongitude <- as.numeric(DB_camera_trap$decimalLongitude)
#get poligon of Colombia
co <- raster::getData("GADM",country="CO",level=1,download=TRUE)
col <-raster::getData("GADM",country="CO",level=0,download=TRUE)
co_sf <- st_as_sf(co) %>% select(NAME_1)
col_sf <- st_as_sf(col)
DB_camera_trap_sf <- st_as_sf(DB_camera_trap, coords = c("decimalLongitude", "decimalLatitude"), crs = "+proj=longlat +datum=WGS84 +no_defs")
Coleccion por Institucion
Camera trap
DB_camera_trap_sf$responsable <- DB_camera_trap_sf$`RESPONSABLE ENVÍO`
mapview(DB_camera_trap_sf[c("responsable", "municipality")])
#
# map3 <- DB_camera_trap_sf %>% filter(order=="Artiodactyla")%>% select(responsable) %>% slice(1:500) # %>% plot()
#
# mapbase + map3
#
#
# map2<- DB_camera_trap_sf %>% sf::filter.sf(order=="Artiodactyla") %>%
# sf::select.sf("responsable") %>% plot() +
# geom_point(aes(color = `RESPONSABLE ENVÍO`) ,
# size = 1,
# alpha=3/4) +
# mapbase +
# theme_light() + # guides(col = guide_legend(ncol = 2)) +
# # theme(legend.position="bottom") + #right
# theme(legend.key = element_rect(colour = "white")) +
# labs(colour="Institución")+
# theme(axis.text.x = element_text(angle = 90)) +
# facet_wrap(~ order, ncol = 5)
#
#
# map2