Cartography and data analyses on Rstudio

Hello,

I have extracted data on plant harvests from the Tropicos database. I have a table of data (CSV format) with many columns, 3 of which are of interest to me:

  • LatitudeDecimal
  • LongitudeDecimal
  • Species (this table contains many different species)

I have already managed to create a distribution map of these species with the background of the Malagasy map. Here is the code:

data_unique <- data %>
group_by(LongitudeDecimal, LatitudeDecimal) %>%
slice_head(n = 1) %>%
ungroup()

Convert the dataset to a SpatialPointsDataFrame object

data_sp <- SpatialPointsDataFrame(data_unique[,c("LongitudeDecimal", "LatitudeDecimal")], data_unique)

library(sf)
data_sf <- st_as_sf(data_sp)

assign the CRS of madagascar to data_sf

st_crs(data_sf) <- st_crs(madagascar)
data_sf <- data_sf[st_intersects(data_sf, madagascar),]

st_crs(data_sf)
st_crs(madagascar)

library(ggplot2)
ggplot() +
geom_sf(data = data_sf) +
geom_sf(data = madagascar, fill = NA, color = "red «

My question is how can I create distribution areas for each species? I would like to connect all the points of the same species and create an area that contains all these points.

Thanks

)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.