R/fauna_spat_occ.R
fauna_spat_occ.Rd
Get Spatial polygons (SpatVectors) of species based on its distribution (states and countrys) according to Fauna do Brasil
fauna_spat_occ(data, species, state = TRUE, country = TRUE,
spat_state = NULL, spat_country = NULL, verbose = TRUE)
(data.frame) the data.frame imported with the
load_faunabr
function.
(character) one or more species names (only genus and specific epithet, eg. "Panthera onca")
(logical) get SpatVector of states with occurrence of the species? Default = TRUE
(logical) get SpatVector of countrys with occurrence of the species? Default = TRUE
(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.
(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.
(logical) Whether to display species being filtered during function execution. Set to TRUE to enable display, or FALSE to run silently. Default = TRUE.
A list with SpatVectors of states and/or countrys for each specie.
library(terra)
#> terra 1.8.54
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)
#> Getting states of Panthera onca
#> Getting countries of Panthera onca
#> Getting states of Mazama jucunda
#> Getting countries of Mazama jucunda
#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)