Learn R Programming

BIEN (version 1.2.7)

BIEN_ranges_genus: Download range maps for given genus.

Description

BIEN_ranges_genus extracts range maps for the specified genera.

Usage

BIEN_ranges_genus(
  genus,
  directory = NULL,
  matched = TRUE,
  match_names_only = FALSE,
  include.gid = FALSE,
  ...
)

Value

Range maps for all available species within the specified genera.

Arguments

genus

A single genus or a vector of genera.

directory

Directory that range maps should be saved in. If none is specified, range maps will be saved in the current working directory.

matched

Return a list of taxa that were downloaded. Default is TRUE.

match_names_only

Check for range maps for the taxa specified without downloading range maps. Default is FALSE.

include.gid

Should the files returned have a unique GID appended to them? This is needed if downloading multiple maps for the same species.

...

Additional arguments passed to internal functions.

See Also

Other range functions: BIEN_ranges_box(), BIEN_ranges_intersect_species(), BIEN_ranges_list(), BIEN_ranges_load_species(), BIEN_ranges_sf(), BIEN_ranges_shapefile_to_skinny(), BIEN_ranges_skinny_ranges_to_richness_raster(), BIEN_ranges_species(), BIEN_ranges_species_bulk()

Examples

Run this code
if (FALSE) {
library(maps)
library(sf)

genus_vector <- c("Abies","Acer")

temp_dir <- file.path(tempdir(), "BIEN_temp")#Set a working directory

BIEN_ranges_genus(genus_vector)

BIEN_ranges_genus(genus = genus_vector,
                  match_names_only = TRUE)

BIEN_ranges_genus(genus = genus_vector,
                  directory = temp_dir) #saves ranges to a specified working directory

BIEN_ranges_genus("Abies")

BIEN_ranges_genus(genus = "Abies",
                  directory = temp_dir)

#Reading files

Abies_poly <- read_sf(dsn = temp_dir,layer = "Abies_lasiocarpa")

#Plotting files

plot(Abies_poly[1]) #plots the range, but doesn't mean much without any reference

map('world', fill = TRUE, col = "grey") #plots a world map (WGS84 projection), in grey

plot(Abies_poly[1],
     col="forest green",
     add = TRUE) #adds the range of Abies lasiocarpa to the map

# Getting data from the files (currently only species names)

Abies_poly$species#gives the species name associated with "Abies_poly"
}

Run the code above in your browser using DataLab