vignettes/rangemap_short_tutorial_I.Rmd
rangemap_short_tutorial_I.Rmd
The rangemap R package presents various tools to create species range maps based on occurrence data, statistics, and SpatialPolygons objects. Other tools of this package can be used to analyze environmental characteristics of the species ranges and to create high quality figures of these maps.
The main functions of this package are:
All the functions that create species ranges also generate an approach to the species extent of occurrence (using convex hulls) and the area of occupancy according to the IUCN criteria. Shapefiles of the resultant polygons can be saved in the working directory if it is needed.
The data included in this package are:
Let’s read the species records and check how the are geographically distributed using the rangemap_explore function.
# Getting the data
data("occ_f", package = "rangemap")
# checking which countries may be involved in the analysis
par(mar = rep(0, 4)) # optional, reduces the margins of the figure
rangemap_explore(occurrences = occ_f)
rangemap_explore(occurrences = occ_f, show_countries = TRUE)
Let’s check the rangemap_boundaries function’s help to be aware of all the parameters.
help(rangemap_boundaries)
Defining parameters and reading the data
# Getting the data
data("occ_d", package = "rangemap")
# preparing arguments
level <- 0 # Level of detail for administrative areas
adm <- "Ecuador" # Although no record is on this country, we know it is in Ecuador
countries <- c("PER", "BRA", "COL", "VEN", "ECU", "GUF", "GUY", "SUR", "BOL") # ISO names of countries involved in the analysis
Now we can create the species range based on administrative areas
b_range <- rangemap_boundaries(occurrences = occ_d, adm_areas = adm,
country_code = countries, boundary_level = level)
If you want to save the results of this analysis as shapefiles try using the parameters save_shp and name.
save <- TRUE # to save the results
name <- "test" # name of the results
b_range <- rangemap_boundaries(occurrences = occ_d, adm_areas = adm,
country_code = countries, boundary_level = level,
save_shp = save, name = name)
The function rangemap_plot will allow you to produce a nice figure of your results.
Check the function’s help to be aware of all the parameters.
help(rangemap_plot)
Now the figures. One with the species range only.
# arguments for the species range figure
extent <- TRUE
occ <- TRUE
legend <- TRUE
# creating the species range figure
par(mar = rep(0, 4))
rangemap_plot(b_range, add_EOO = extent, add_occurrences = occ,
legend = legend)
The other one with the potential extent of occurrence, the species occurrences and other map details. But let’s first define the characteristics we want in the figure.
extent <- TRUE # adds the extent of occurrence of the species to the figure
occ <- TRUE # adds the occurrence records of the species to the figure
legend <- TRUE # adds a legend to the figure
leg_pos <- "topright" # position of the legend in the figure
north <- TRUE # adds a north arrow to the figure
n_pos <- "bottomleft" # position of the north arrow
par(mar = rep(0, 4), cex = 0.8)
rangemap_plot(b_range, add_EOO = extent, add_occurrences = occ,
legend = legend, legend_position = leg_pos,
northarrow = north, northarrow_position = n_pos)