Skip to content

Instantly share code, notes, and snippets.

@diodon
Last active August 20, 2021 01:42
Show Gist options
  • Select an option

  • Save diodon/489d266abd4a07b9f86a2cf3b770139d to your computer and use it in GitHub Desktop.

Select an option

Save diodon/489d266abd4a07b9f86a2cf3b770139d to your computer and use it in GitHub Desktop.
OBIS: obtener tabla de ocurrencia de especies para la región de Santa Marta, Colombia y hacer un mapa de los sitios. Curso OBIS Módulo 4 sección 1.6
library(robis)
## Define the Region of Interest
SMwkt <- "POLYGON ((-74.39941 11.21882, -74.29779 11.42349, -73.99292 11.46387, -73.89679 11.37772, -73.96271 11.24306, -74.15222 11.16493,
-74.33624 11.13259, -74.39941 11.21882))"
## Get the occurrence records for the ROI
SMocc <- occurrence(geometry = SMwkt)
## get the numero of different scientific names
length(unique(SMocc$scientificName))
## get the most abundant taxon in the table
occTBL <- table(SMocc$scientificName)
occDF <- as.data.frame(occTBL)
taxa1 <- occDF[which.max(occDF$Freq),]
taxa1
## plot the occurrences of the most common taxon
## filter the occurrence table to have the most frequent taxon
occDF1 <- SMocc[SMocc$scientificName==taxa1$Var1,]
map_leaflet(occDF1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment