knitr::opts_chunk$set(echo = TRUE)draft
The initial idea changed to sample just ants and dung bettles in a 80 m grid.
library (tidyverse) # Data handling
library (raster) # grids, rasters
library (rgeos) # coord transform
library (rgdal) # coord transform
library (ggmap) # visualization
library (lubridate) # date managemgemt
library (readxl) # read excel data
library (sf) # vector maps in R
library (sp) # vector old fashon maps in R
library (mapview) # see maps in webpath <- "C:/Users/diego.lizcano/Box Sync/CodigoR/Carbon-Biodiv/Data"
beetle_data <- read_excel(paste(path,"/TNC_Escarabajo_Carbono_June_2018.xlsx", sep=""),
sheet = "Base_Escarabajos")
beetle_data <- beetle_data %>% group_by(Punto) %>%
mutate (Richness = n_distinct(Especie)) # New column richness
beetle_data$LongDD <- beetle_data$LonDD * (-1)
ants_data <- read_excel(paste(path,"/TNC_Escarabajo_Carbono_June_2018.xlsx", sep=""),
sheet = "Base_Hormigas")
ants_data <- ants_data %>% group_by(Punto) %>%
mutate (Richness = n_distinct(Especie))
ants_data$LongDD <- ants_data$LonDD * (-1)beetle_data_sf = st_as_sf(beetle_data, coords = c("LongDD", "LatDD"), crs = "+proj=longlat +datum=WGS84")
# put coords
ants_data_sf = st_as_sf(ants_data, coords = c("LongDD", "LatDD"), crs = "+proj=longlat +datum=WGS84")#
mapview(beetle_data_sf, zcol = "Richness",
col.regions = sf.colors(12),
alpha = 0.1,
legend = TRUE,
map.types = "Esri.WorldImagery")#
mapview(beetle_data_sf, zcol = "Abundancia",
col.regions = sf.colors(12),
alpha = 0.1,
legend = TRUE,
map.types = "Esri.WorldImagery")#
p <- ggplot(beetle_data, aes(x=Cobertura, y=Richness)) +
geom_boxplot()
p#
mapview(ants_data_sf, zcol = "Richness",
col.regions = sf.colors(12),
alpha = 0.1,
legend = TRUE,
map.types = "Esri.WorldImagery")