Learn R Programming

faunabr (version 1.0.0)

fauna_spat_occ: Get Spatial polygons (SpatVectors) of species based on its distribution (states and countrys) according to Fauna do Brasil

Description

Get Spatial polygons (SpatVectors) of species based on its distribution (states and countrys) according to Fauna do Brasil

Usage

fauna_spat_occ(data, species, state = TRUE, country = TRUE,
                      spat_state = NULL, spat_country = NULL, verbose = TRUE)

Value

A list with SpatVectors of states and/or countrys for each specie.

Arguments

data

(data.frame) the data.frame imported with the load_faunabr function.

species

(character) one or more species names (only genus and specific epithet, eg. "Panthera onca")

state

(logical) get SpatVector of states with occurrence of the species? Default = TRUE

country

(logical) get SpatVector of countrys with occurrence of the species? Default = TRUE

spat_state

(SpatVector) a SpatVector of the Brazilian states. By default, it uses the SpatVector provided by geobr::read_state(). It can be another Spatvector, but the structure must be identical to 'faunabr::states', with a column called "abbrev_state" identifying the states codes.

spat_country

(SpatVector) a SpatVector of the world countries. By default, it uses the SpatVector provided by rnaturalearth::ne_countries. It can be another Spatvector, but the structure must be identical to 'faunabr::world_fauna', with a column called "country_code" identifying the country codes.

verbose

(logical) Whether to display species being filtered during function execution. Set to TRUE to enable display, or FALSE to run silently. Default = TRUE.

Examples

Run this code
library(terra)
data("fauna_data")
spp <- c("Panthera onca", "Mazama jucunda")
#Get states, countrys and intersection states-countrys of species
spp_spt <- fauna_spat_occ(data = fauna_data, species = spp, state = TRUE,
                          country = TRUE, verbose = TRUE)
#Plot states with confirmed occurrence of Panthera onca and Mazama jucunda
plot(spp_spt$`Panthera onca`$states)
plot(spp_spt$`Mazama jucunda`$states)
#Plot countries with confirmed occurrence of Panthera onca and Mazama jucunda
plot(spp_spt$`Panthera onca`$countries)
plot(spp_spt$`Mazama jucunda`$countries)

Run the code above in your browser using DataLab