### Get available attributes example Source: https://wevertonbio.github.io/florabr/reference/get_attributes.html Example showing how to retrieve available biomes, life forms, and states from the loaded data. ```R data("bf_data") #Load Flora e Funga do Brasil data # Get available biomes, life forms and states to filter species d <- get_attributes(data = bf_data, attribute = c("biome", "lifeform", "states")) ``` -------------------------------- ### Install and Load mapview Source: https://wevertonbio.github.io/florabr/articles/Spatialize_florabr.html Install and load the mapview package for interactive mapping. ```R #Install mapview if necessary and load package if(!require(mapview)){ install.packages("geobr") } #Load mapview library(mapview) ``` -------------------------------- ### get_florabr usage example Source: https://wevertonbio.github.io/florabr/reference/get_florabr.html Example usage of get_florabr. Creates a temporary directory and downloads the latest database version. The example is wrapped in \dontrun and should be run manually. ```r if (FALSE) { # \dontrun{ #Creating a folder in a temporary directory #Replace 'file.path(tempdir(), "florabr")' by a path folder to be create in #your computer my_dir <- file.path(file.path(tempdir(), "florabr")) dir.create(my_dir) #Download, merge and save data get_florabr(output_dir = my_dir, data_version = "latest", solve_discrepancy = FALSE, overwrite = TRUE, verbose = TRUE) } # } ``` -------------------------------- ### Example: Get states, biomes, and intersections for species Source: https://wevertonbio.github.io/florabr/reference/get_spat_occ.html Loads Flora e Funga do Brasil data, defines two example species, and calls get_spat_occ to retrieve SpatVectors for states, biomes, and their intersections. The output messages show the progress for each species. Then plots the results for Araucaria angustifolia. ```r library(terra) #> terra 1.8.70 data("bf_data") #Load Flora e Funga do Brasil data spp <- c("Araucaria angustifolia", "Adesmia paranensis") #Example species #Get states, biomes and intersection states-biomes of species spp_spt <- get_spat_occ(data = bf_data, species = spp, state = TRUE, biome = TRUE, intersection = TRUE, state_vect = NULL, biome_vect = NULL, verbose = TRUE) #> Getting states of Araucaria angustifolia #> Getting biomes of Araucaria angustifolia #> Getting biomes of Araucaria angustifolia #> Getting states of Adesmia paranensis #> Getting biomes of Adesmia paranensis #> Getting biomes of Adesmia paranensis #Plot states of occurrence of Araucaria angustifolia plot(spp_spt[[1]]$states, main = names(spp_spt)[[1]]) #Plot biomes of occurrence of Araucaria angustifolia plot(spp_spt[[2]]$biomes, main = names(spp_spt)[[2]]) #Plot intersection between states and biomes of occurrence of #Araucaria angustifolia plot(spp_spt[[1]]$states_biomes) ``` -------------------------------- ### Install and load geobr Source: https://wevertonbio.github.io/florabr/articles/Spatialize_florabr.html Install the geobr package if it is not already present in your environment. ```R #Install geobr if necessary and load package if(!require(geobr)){ install.packages("geobr") } #Load geobr library(geobr) ``` -------------------------------- ### Example solving discrepancies with bf_data Source: https://wevertonbio.github.io/florabr/reference/solve_discrepancies.html Loads example data, checks and solves discrepancies, and verifies the solution attribute is set to TRUE. ```r data("bf_data") #Load Flora e Funga do Brasil data #Check if discrepancies were solved in the dataset attr(bf_data, "solve_discrepancies") #> [1] FALSE #Solve discrepancies bf_solved <- solve_discrepancies(bf_data) #Check if discrepancies were solved in the dataset attr(bf_solved, "solve_discrepancies") #> [1] TRUE ``` -------------------------------- ### Install florabr from GitHub Source: https://wevertonbio.github.io/florabr/index.html Installs the development version of florabr from GitHub using the remotes package, then loads the library. ```R if(!require(remotes)){ install.packages("remotes") } if(!require(florabr)){ remotes::install_github("wevertonbio/florabr")} library(florabr) ``` -------------------------------- ### Example usage of load_florabr Source: https://wevertonbio.github.io/florabr/reference/load_florabr.html Demonstrates creating a directory, downloading data with get_florabr, and loading it using load_florabr. ```R if (FALSE) { # \dontrun{ #Creating a folder in a temporary directory #Replace 'file.path(tempdir(), "florabr")' by a path folder to be create in #your computer my_dir <- file.path(file.path(tempdir(), "florabr")) dir.create(my_dir) #Download, merge and save data get_florabr(output_dir = my_dir, data_version = "latest", overwrite = TRUE, verbose = TRUE) #Load data df <- load_florabr(data_dir = my_dir, data_version = "Latest_available", type = "short") } # } ``` -------------------------------- ### Example: Check Version in Current Directory Source: https://wevertonbio.github.io/florabr/reference/check_version.html Checks for the presence of the dataset in the current working directory and provides a message if the version is outdated or missing. ```R #Check if there is a version of Flora e Funga do Brasil data available in the #current directory check_version(data_dir = getwd()) #> You do not have any version of Flora e Funga do Brasil in this directory. #> The latest version is 393.419. Please, change the directory or #> run the function get_florabr() to download the latest version of Flora e #> Funga do Brasil. ``` -------------------------------- ### Install florabr from CRAN Source: https://wevertonbio.github.io/florabr/index.html Installs the stable version of the florabr package from CRAN. ```R install.packages("florabr") ``` -------------------------------- ### Subset species including subspecies and varieties Source: https://wevertonbio.github.io/florabr/articles/selecting_species.html This example shows how to include both subspecies and varieties when subsetting species data. ```R my_sp2 <- subset_species(data = bf, species = accepted_names, include_subspecies = TRUE, include_variety = TRUE, kingdom = "Plantae") my_sp2[1:5,] #> species scientificName #> 11785 Solanum restingae Solanum restingae S.Knapp #> 26790 Araucaria angustifolia Araucaria angustifolia (Bertol.) Kuntze #> 35204 Araucaria angustifolia Araucaria angustifolia var. alba Reitz #> 35205 Araucaria angustifolia Araucaria angustifolia var. caiova Reitz #> 35206 Araucaria angustifolia Araucaria angustifolia var. caiuva Mattos #> acceptedName kingdom Group Subgroup family #> 11785 Plantae Angiosperms Solanaceae #> 26790 Plantae Gymnosperms Araucariaceae #> 35204 Araucaria angustifolia Plantae Gymnosperms Araucariaceae #> 35205 Araucaria angustifolia Plantae Gymnosperms Araucariaceae #> 35206 Araucaria angustifolia Plantae Gymnosperms Araucariaceae #> genus lifeForm habitat Biome States #> 11785 Solanum Shrub Terrestrial Atlantic_Forest BA #> 26790 Araucaria Tree Terrestrial Atlantic_Forest;Pampa MG;PR;RJ;RS;SC;SP #> 35204 Araucaria #> 35205 Araucaria #> 35206 Araucaria #> vegetationType #> 11785 Restinga #> 26790 High_Altitude_Grassland;Mixed_Ombrophyllous_Forest; #> Seasonally_Semideciduous_Forest #> 35204 #> 35205 #> 35206 #> origin endemism taxonomicStatus nomenclaturalStatus #> 11785 Native Endemic Accepted Correct #> 26790 Native Non-endemic Accepted Correct #> 35204 Synonym #> 35205 Synonym #> 35206 Synonym #> vernacularName #> 11785 #> 26790 araucaria, pinheiro-do-parana, curi, pinheiro-brasileiro, #> pinho-do-parana #> 35204 #> 35205 #> 35206 #> taxonRank #> 11785 Species #> 26790 Species #> 35204 Variety #> 35205 Variety #> 35206 Variety ``` -------------------------------- ### Extracting species synonyms example Source: https://wevertonbio.github.io/florabr/reference/get_synonym.html Example usage of get_synonym to retrieve synonyms for specific species, including the resulting data frame output. ```R data("bf_data") #Load Flora e Funga do Brasil data #Species to extract synonyms spp <- c("Araucaria angustifolia", "Adesmia paranensis") spp_synonyms <- get_synonym(data = bf_data, species = spp, include_subspecies = TRUE, include_variety = TRUE) spp_synonyms #> acceptedName synonym #> 35312 Araucaria angustifolia Araucaria angustifolia var. alba #> 35313 Araucaria angustifolia Araucaria angustifolia var. caiova #> 35314 Araucaria angustifolia Araucaria angustifolia var. caiuva #> 35315 Araucaria angustifolia Araucaria angustifolia var. dependens #> 35316 Araucaria angustifolia Araucaria angustifolia var. indehiscens #> 35317 Araucaria angustifolia Araucaria angustifolia var. monoica #> 35318 Araucaria angustifolia Araucaria angustifolia var. nigra #> 35319 Araucaria angustifolia Araucaria angustifolia var. sancti-josephi #> 35320 Araucaria angustifolia Araucaria angustifolia var. semialba #> 35321 Araucaria angustifolia Araucaria angustifolia var. stricta #> 35322 Araucaria angustifolia Araucaria angustifolia var. vinacea #> 35323 Araucaria angustifolia Araucaria brasiliana #> 35324 Araucaria angustifolia Araucaria brasiliana var. elegans #> 35325 Araucaria angustifolia Araucaria brasiliensis #> 35326 Araucaria angustifolia Araucaria brasiliensis var. saviana #> 35327 Araucaria angustifolia Araucaria dioica #> 35328 Araucaria angustifolia Araucaria elegans #> 35329 Araucaria angustifolia Araucaria ridolfiana #> 35330 Araucaria angustifolia Araucaria saviana #> 35332 Araucaria angustifolia Columbea angustifolia #> 35333 Araucaria angustifolia Columbea brasiliana #> 60644 Araucaria angustifolia Pinus dioica #> 141010 Araucaria angustifolia Araucaria brasiliana var. ridolfiana #> 141020 Araucaria angustifolia Araucaria bibbiani #> 141021 Araucaria angustifolia Araucaria lindleyana #> 141041 Araucaria angustifolia Araucaria brasiliana #> 85308 Adesmia paranensis Adesmia psoraleoides var. glabrata #> taxonomicStatus nomenclaturalStatus #> 35312 Synonym #> 35313 Synonym #> 35314 Synonym #> 35315 Synonym #> 35316 Synonym #> 35317 Synonym #> 35318 Synonym #> 35319 Synonym #> 35320 Synonym #> 35321 Synonym #> 35322 Synonym #> 35323 Synonym #> 35324 Synonym #> 35325 Synonym #> 35326 Synonym #> 35327 Synonym #> 35328 Synonym #> 35329 Synonym #> 35330 Synonym #> 35332 Synonym Legitimate_but_incorrect #> 35333 Synonym Legitimate_but_incorrect #> 60644 Synonym #> 141010 Synonym #> 141020 Synonym #> 141021 Synonym #> 141041 Synonym Illegitimate #> 85308 Synonym Legitimate_but_incorrect ``` -------------------------------- ### Example: search for 'pinheiro' with exact = TRUE Source: https://wevertonbio.github.io/florabr/reference/select_by_vernacular.html Loads the bf_data dataset and searches for species whose vernacular name exactly matches 'pinheiro'. The output shows the resulting data.frame with species like Araucaria columnaris and various Pinus species. ```r data("bf_data") #Load Flora e Funga do Brasil data #Search for species whose vernacular name is 'pinheiro' pinheiro_exact <- select_by_vernacular(data = bf_data, names = "pinheiro", exact = TRUE) pinheiro_exact #> species #> 134218 Araucaria columnaris #> 140840 Pinus canariensis #> 140842 Pinus banksiana #> 140856 Pinus palustris #> 140864 Pinus nigra #> 140890 Pinus echinata #> 140902 Pinus densiflora #> 140986 Pinus tecunumanii #> 140991 Pinus thunbergii #> scientificName acceptedName #> 134218 Araucaria columnaris (J.R.Forst.) Hook. #> 140840 Pinus canariensis C.Sm. #> 140842 Pinus banksiana Lamb. #> 140856 Pinus palustris Mill. #> 140864 Pinus nigra J.F.Arnold #> 140890 Pinus echinata Mill. #> 140902 Pinus densiflora Siebold & Zucc. #> 140986 Pinus tecunumanii F.Schwerdtf. ex Eguiluz & J.P.Perry #> 140991 Pinus thunbergii Parl. #> kingdom group subgroup phylum class order #> 134218 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140840 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140842 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140856 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140864 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140890 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140902 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140986 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> 140991 Plantae Gymnosperms Tracheophyta Pinopsida Pinales #> family genus lifeForm habitat biome #> 134218 Araucariaceae Araucaria Tree Terrestrial Unknown #> 140840 Pinaceae Pinus Tree Terrestrial Unknown #> 140842 Pinaceae Pinus Tree Terrestrial Unknown #> 140856 Pinaceae Pinus Tree Terrestrial Unknown #> 140864 Pinaceae Pinus Tree Terrestrial Unknown #> 140890 Pinaceae Pinus Tree Terrestrial Unknown #> 140902 Pinaceae Pinus Tree Terrestrial Unknown #> 140986 Pinaceae Pinus Tree Terrestrial Unknown #> 140991 Pinaceae Pinus Tree Terrestrial Unknown #> states vegetation origin endemism #> 134218 MG;PB;PE;PR;RS;SC;SE;SP Anthropic_Area Cultivated Non-endemic #> 140840 MG;RJ;RS;SP Anthropic_Area Cultivated Non-endemic #> 140842 RS Anthropic_Area Cultivated Non-endemic #> 140856 PR;RS;SC;SP Anthropic_Area Cultivated Non-endemic #> 140864 RS;SP Anthropic_Area Cultivated Non-endemic #> 140890 PR;RS;SP Anthropic_Area Cultivated Non-endemic #> 140902 MG Anthropic_Area Cultivated Non-endemic #> 140986 SP Anthropic_Area Naturalized Non-endemic #> 140991 PR;SP Anthropic_Area Cultivated Non-endemic #> taxonomicStatus nomenclaturalStatus #> 134218 Accepted Correct #> 140840 Accepted #> 140842 Accepted #> 140856 Accepted #> 140864 Accepted #> 140890 Accepted #> 140902 Accepted #> 140986 Accepted ``` -------------------------------- ### Generate a PAM with get_pam Source: https://wevertonbio.github.io/florabr/articles/getting_pam.html Filter species data using select_species and generate a presence-absence matrix with get_pam. This example demonstrates filtering for endemic tree species in the Amazon biome. ```R #Load Flora e Funga do Brasil data data("bf_data") #Select endemic and native species of trees with occurrence only in Amazon am_trees <- select_species(data = bf_data, include_subspecies = FALSE, include_variety = FALSE, kingdom = "Plantae", group = "All", subgroup = "All", family = "All", genus = "All", lifeForm = "Tree", filter_lifeForm = "only", habitat = "All", filter_habitat = "in", biome = "Amazon", filter_biome = "only", state = "All", filter_state = "and", vegetation = "All", filter_vegetation = "in", endemism = "Endemic", origin = "Native", taxonomicStatus = "Accepted", nomenclaturalStatus = "All") #Get presence-absence matrix pam_am <- get_pam(data = am_trees, by_biome = TRUE, by_state = TRUE, by_vegetation = FALSE, remove_empty_sites = TRUE, return_richness_summary = TRUE, return_spatial_richness = TRUE, return_plot = TRUE) #Visualize (as tibble) the PAM for the first 5 species and 7 sites tibble::tibble(pam_am$PAM[1:7, 1:5]) # # A tibble: 7 × 5 # Biome States `Euxylophora paraensis` `Galipea congestiflora` `Hortia longifolia` # # 1 Amazon AM 1 0 1 # 2 Amazon MA 1 1 0 # 3 Amazon PA 1 1 1 # 4 Amazon TO 1 1 0 # 5 Amazon MT 0 0 1 # 6 Amazon RR 0 0 1 # 7 Amazon AC 0 0 0 ``` -------------------------------- ### Get available filter options with get_attributes Source: https://wevertonbio.github.io/florabr/articles/selecting_species.html Shows how to use get_attributes() to list the available filter options for lifeForm, Biome, and vegetation attributes. The output includes the exact options that can be used in the select_species() function. Note the attribute names are case-sensitive and the output includes a 'Not_found_in_brazil' option for Biome. ```r #Get available options to filter by lifeForm get_attributes(data = bf, attribute = "lifeForm")[[1]] #> lifeForm #> 1 Aquatic-Benthos #> 2 Aquatic-Neuston #> 3 Aquatic-Plankton #> 4 Shrub #> 5 Tree #> 6 Bamboo #> 7 Cushion #> 8 Dendroid #> 9 Unknown #> 10 Dracaenoid #> 13 Herb #> 14 Flabellate #> 15 Foliose #> 16 Liana/scandent/vine #> 19 Palm_tree #> 21 Pendent #> 23 Subshrub #> 24 Succulent #> 25 Thallose #> 26 Mat #> 27 Weft #> 28 Tuft ``` ```r #Get available options to filter by Biome get_attributes(data = bf, attribute = "Biome")[[1]] #> biome #> 1 Amazon #> 2 Atlantic_Forest #> 3 Caatinga #> 4 Cerrado #> 5 Pampa #> 6 Pantanal #> 7 Not_found_in_brazil ``` ```r #Get available options to filter by vegetation get_attributes(data = bf, attribute = "vegetation")[[1]] #> vegetation #> 1 Anthropic_Area #> 2 Caatinga #> 3 Amazonian_Campinarana #> 4 High_Altitude_Grassland #> 5 Flooded_Field #> 6 Grassland #> 7 Highland_Rocky_Field #> 8 Carrasco #> 9 Cerrado #> 10 Gallery_Forest #> 11 Inundated_Forest_Igapo #> 12 Terra_Firme_Forest #> 13 Inundated_Forest #> 14 Seasonallly_Deciduous_Forest #> 15 Seasonal_Evergreen_Forest #> 16 Seasonally_Semideciduous_Forest #> 17 Rainforest #> 18 Mixed_Ombrophyllous_Forest #> 19 Mangrove #> 20 Palm_Grove #> 21 Restinga #> 22 Amazonian_Savanna #> 23 Aquatic_vegetation #> 24 Rock_outcrop_vegetation #> 25 Not_found_in_Brazil ``` -------------------------------- ### filter_florabr function definition and example usage Source: https://wevertonbio.github.io/florabr/reference/filter_florabr.html Two code blocks: the function signature showing all arguments and defaults, and an example usage that loads data, subsets occurrences for a species, and calls filter_florabr with verbose = FALSE. The example returns a list with flagged and cleaned data.frames by default. ```R filter_florabr(data, occ, species = "species", long = "x", lat = "y", by_state = TRUE, buffer_state = 20, by_biome = TRUE, buffer_biome = 20, by_endemism = TRUE, buffer_brazil = 20, state_vect = NULL, state_column = NULL, biome_vect = NULL, biome_column = NULL, br_vect = NULL, value = "flag&clean", keep_columns = TRUE, verbose = TRUE) ``` ```R data("bf_data") #Load Flora e Funga do Brasil data data("occurrences") #Load occurrences pts <- subset(occurrences, species == "Myrcia hatschbachii") fd <- filter_florabr(data = bf_data, occ = pts, by_state = TRUE, buffer_state = 20, by_biome = TRUE, buffer_biome = 20, by_endemism = TRUE, buffer_brazil = 20, state_vect = NULL, biome_vect = NULL, br_vect = NULL, value = "flag&clean", keep_columns = TRUE, verbose = FALSE) ``` -------------------------------- ### load_florabr(data_dir, data_version, type, verbose) Source: https://wevertonbio.github.io/florabr/reference/load_florabr.html Loads the Flora e Funga do Brasil database from a local directory. The function returns a data.frame with the specified version and column set, which is required for most package functions. ```APIDOC ## load_florabr(data_dir, data_version, type, verbose) ### Description Loads the Flora e Funga do Brasil database from a local directory. The function returns a data.frame with the specified version and column set, which is required for most package functions. ### Method R function ### Endpoint load_florabr(data_dir, data_version = "Latest_available", type = "short", verbose = TRUE) ### Parameters #### Arguments - **data_dir** (character) - Required - The same directory used to save the data downloaded from Flora e Funga do Brasil using the get_florabr function. - **data_version** (character) - Optional - The version of Flora e Funga do Brasil database to be loaded. Can be "Latest_available" to load the latest version available, or another specified version (e.g., "393.364"). Default = "Latest_available". - **type** (character) - Optional - Determines the number of columns to load. Can be "short" or "complete". Default = "short". See details. - **verbose** (logical) - Optional - Whether to display messages during function execution. Set to TRUE to enable display, or FALSE to run silently. Default = TRUE. ### Request Example ```r load_florabr(data_dir = my_dir, data_version = "Latest_available", type = "short") ``` ### Response #### Value A data.frame with the specified version (default is the latest available) of the Flora e Funga do Brasil database. This data.frame is necessary to run most of the functions of the package. #### Details If type = "short", it loads a data.frame with the 20 columns needed to run other functions: species, scientificName, acceptedName, kingdom, Group, Subgroup, family, genus, lifeForm, habitat, Biome, States, vegetationType, Origin, Endemism, taxonomicStatus, nomenclaturalStatus, vernacularName, taxonRank, and id. If type = "complete", it loads a data.frame with all 39 variables available in the Flora e Funga do Brasil database. ``` -------------------------------- ### Example: Extract binomial names from a vector of scientific names Source: https://wevertonbio.github.io/florabr/reference/get_binomial.html Example usage of get_binomial with a vector of scientific names. The function is called with default arguments, and the output shows the extracted binomial names, including infraspecific epithets when present (e.g., 'var. alba' and 'subsp. punctata'). ```R spp <- c("Araucaria angustifolia (Bertol.) Kuntze", "Araucaria angustifolia var. alba Reitz", "Butia catarinensis Noblick & Lorenzi", "Butia eriospatha subsp. punctata", "Adesmia paranensis Burkart") spp_new <- get_binomial(species_names = spp, include_subspecies = TRUE, include_variety = TRUE) spp_new #> [1] "Araucaria angustifolia" "Araucaria angustifolia var. alba" #> [3] "Butia catarinensis" "Butia eriospatha subsp. punctata" #> [5] "Adesmia paranensis" ``` -------------------------------- ### Get Brazil Polygon Source: https://wevertonbio.github.io/florabr/articles/Spatialize_florabr.html Retrieve the Brazil country polygon using geobr. ```R #Get Brazl Polygon br <- geobr::read_country() ``` -------------------------------- ### get_pam(data, by_biome, by_state, by_vegetation, remove_empty_sites, return_richness_summary, return_spatial_richness, return_plot) Source: https://wevertonbio.github.io/florabr/reference/get_pam.html Generates a presence-absence matrix of species based on their distribution (states, biomes, and vegetation types) according to Flora e Funga do Brasil. The function accepts a data.frame imported with load_florabr or generated by select_species or subset_species, and returns a list with the PAM, richness summary, and spatial richness if requested. ```APIDOC ## get_pam(data, by_biome = TRUE, by_state = TRUE, by_vegetation = FALSE, remove_empty_sites = TRUE, return_richness_summary = TRUE, return_spatial_richness = TRUE, return_plot = TRUE) ### Description Get a presence-absence matrix of species based on its distribution (states, biomes and vegetation types) according to Flora e Funga do Brasil. ### Usage ```r get_pam(data, by_biome = TRUE, by_state = TRUE, by_vegetation = FALSE, remove_empty_sites = TRUE, return_richness_summary = TRUE, return_spatial_richness = TRUE, return_plot = TRUE) ``` ### Arguments - **data** (data.frame) - Required - a data.frame imported with the `load_florabr` function or generated by either `select_species` or `subset_species` functions - **by_biome** (logical) - Optional - get occurrences by biome. Default = TRUE - **by_state** (logical) - Optional - get occurrences by State. Default = TRUE - **by_vegetation** (logical) - Optional - get occurrences by vegetation type. Default = FALSE - **remove_empty_sites** (logical) - Optional - remove empty sites (sites without any species) from final presence-absence matrix. Default = TRUE - **return_richness_summary** (logical) - Optional - return a data.frame with the number of species in each site. Default = TRUE - **return_spatial_richness** (logical) - Optional - return a SpatVector with the number of species in each site. Default = TRUE - **return_plot** (logical) - Optional - plot map with the number of species in each site. Only works if return_spatial_richness = TRUE. Default = TRUE ### Value If return_richness_summary and/or return_spatial_richness is set to TRUE, return a list with: - **PAM**: the presence-absence matrix (PAM) - **Richness_summary**: a data.frame with the number of species in each site - **Spatial_richness**: a SpatVector with the number of species in each site (only by State and biome) If return_richness_summary and return_spatial_richness is set to FALSE, return a presence-absence matrix. ### Examples ```r data("bf_data") #Load Flora e Funga do Brasil data #Select endemic and native species of trees with occurrence only in Amazon am_trees <- select_species(data = bf_data, include_subspecies = FALSE, include_variety = FALSE, kingdom = "Plantae", group = "All", subgroup = "All", family = "All", genus = "All", lifeForm = "Tree", filter_lifeForm = "only", habitat = "All", filter_habitat = "in", biome = "Amazon", filter_biome = "only", state = "All", filter_state = "and", vegetation = "All", filter_vegetation = "in", endemism = "Endemic", origin = "Native", taxonomicStatus = "Accepted", nomenclaturalStatus = "All") #Get presence-absence matrix pam_am <- get_pam(data = am_trees, by_biome = TRUE, by_state = TRUE, by_vegetation = FALSE, remove_empty_sites = TRUE, return_richness_summary = TRUE, return_spatial_richness = TRUE, return_plot = TRUE) ``` ``` -------------------------------- ### Extract species with subset_species Source: https://wevertonbio.github.io/florabr/reference/subset_species.html Example usage of subset_species. Loads the built-in bf_data dataset, defines a vector of species names, and calls subset_species with default arguments. The output shows the resulting data.frame with columns such as species, scientificName, kingdom, family, and states. The example demonstrates that the function returns a data.frame with the selected species. ```r data("bf_data") #Load Flora e Funga do Brasil data #Species to extract from database spp <- c("Araucaria angustifolia", "Adesmia paranensis") spp_bf <- subset_species(data = bf_data, species = spp, include_subspecies = FALSE, include_variety = FALSE) spp_bf #> species scientificName #> 26797 Araucaria angustifolia Araucaria angustifolia (Bertol.) Kuntze #> 82146 Adesmia paranensis Adesmia paranensis Burkart #> acceptedName kingdom group subgroup phylum class #> 26797 Plantae Gymnosperms Tracheophyta Pinopsida #> 82146 Plantae Angiosperms Tracheophyta Magnoliopsida #> order family genus lifeForm habitat #> 26797 Pinales Araucariaceae Araucaria Tree Terrestrial #> 82146 Fabales Fabaceae Adesmia Subshrub Terrestrial #> biome states #> 26797 Atlantic_Forest;Pampa MG;PR;RJ;RS;SC;SP #> 82146 Atlantic_Forest PR;SC #> vegetation #> 26797 High_Altitude_Grassland;Mixed_Ombrophyllous_Forest;Seasonally_Semideciduous_Forest #> 82146 High_Altitude_Grassland #> origin endemism taxonomicStatus nomenclaturalStatus #> 26797 Native Non-endemic Accepted Correct #> 82146 Native Endemic Accepted Correct #> vernacularName #> 26797 araucaria, pinheiro-do-parana, curi, pinheiro-brasileiro, pinho-do-parana #> 82146 #> taxonRank id #> 26797 Species 33971 #> 82146 Species 101033 ``` -------------------------------- ### Compare simplified and original geometries Source: https://wevertonbio.github.io/florabr/articles/Spatialize_florabr.html Visualize the difference in complexity between simplified and non-simplified state geometries. ```R #Plot only State of Parana as example par(mfrow = c(1, 2), mar = c(2, 2, 2, 2)) plot(br_states[br_states$abbrev_state == "PR"], main = "Not simplified geometries", mar = NA) plot(states[states$abbrev_state == "PR"], main = "Simplified geometries", mar = NA) ``` -------------------------------- ### get_pam function signature Source: https://wevertonbio.github.io/florabr/reference/get_pam.html Shows the usage of the get_pam function with its default arguments. ```r get_pam(data, by_biome = TRUE, by_state = TRUE, by_vegetation = FALSE, remove_empty_sites = TRUE, return_richness_summary = TRUE, return_spatial_richness = TRUE, return_plot = TRUE) ``` -------------------------------- ### Create directory for florabr data Source: https://wevertonbio.github.io/florabr/index.html Creates a directory to save the Flora e Funga do Brasil data. Replace the path with a folder on your computer. ```R #Creating a folder in a temporary directory #Replace 'file.path(tempdir(), "florabr")' by a path folder to be create in your computer my_dir <- file.path(file.path(tempdir(), "florabr")) dir.create(my_dir) ``` -------------------------------- ### Retrieve synonyms with get_synonym Source: https://wevertonbio.github.io/florabr/articles/selecting_species.html This example demonstrates searching for synonyms of 'Araucaria angustifolia' and 'Adesmia paranensis' using the get_synonym function. ```R spp <- c("Araucaria angustifolia", "Adesmia paranensis") spp_syn <- get_synonym(data = bf, species = spp) spp_syn #> synonym acceptedName taxonomicStatus nomenclaturalStatus #> 35323 Araucaria brasiliana Araucaria angustifolia Synonym #> 35325 Araucaria brasiliensis Araucaria angustifolia Synonym #> 35327 Araucaria dioica Araucaria angustifolia Synonym #> 35328 Araucaria elegans Araucaria angustifolia Synonym #> 35329 Araucaria ridolfiana Araucaria angustifolia Synonym #> 35330 Araucaria saviana Araucaria angustifolia Synonym #> 35332 Columbea angustifolia Araucaria angustifolia Synonym Legitimate_but_incorrect #> 35333 Columbea brasiliana Araucaria angustifolia Synonym Legitimate_but_incorrect #> 60644 Pinus dioica Araucaria angustifolia Synonym #> 141020 Araucaria bibbiani Araucaria angustifolia Synonym #> 141021 Araucaria lindleyana Araucaria angustifolia Synonym #> 141041 Araucaria brasiliana Araucaria angustifolia Synonym Illegitimate #> 85308 Adesmia psoraleoides Adesmia paranensis Synonym Legitimate_but_incorrect ``` -------------------------------- ### Load complete version of florabr data with load_florabr() Source: https://wevertonbio.github.io/florabr/articles/getting_started.html Loads the complete version (39 columns) of the florabr dataset. The output shows the column names of the complete version, which has 20 more columns than the short version. ```R #Complete version bf_complete <- load_florabr(data_dir = my_dir, data_version = "Latest_available", type = "complete") #complete colnames(bf_complete) #See variables from complete version #> [1] "id" "taxonID" #> [3] "acceptedNameUsageID" "parentNameUsageID" #> [5] "originalNameUsageID" "group" #> [7] "subgroup" "species" #> [9] "acceptedName" "scientificName" #> [11] "acceptedNameUsage" "parentNameUsage" #> [13] "namePublishedIn" "namePublishedInYear" #> [15] "higherClassification" "kingdom" #> [17] "phylum" "class" #> [19] "order" "family" #> [21] "genus" "specificEpithet" #> [23] "infraspecificEpithet" "taxonRank" #> [25] "scientificNameAuthorship" "taxonomicStatus" #> [27] "nomenclaturalStatus" "vernacularName" #> [29] "lifeForm" "habitat" #> [31] "vegetation" "origin" #> [33] "endemism" "biome" #> [35] "states" "countryCode" #> [37] "modified" "bibliographicCitation" #> [39] "references" ``` -------------------------------- ### Load short version of florabr data with load_florabr() Source: https://wevertonbio.github.io/florabr/articles/getting_started.html Loads the short version (23 columns) of the florabr dataset. By default, it searches for the latest available version in the directory. The output shows the column names of the short version. ```R #Short version bf <- load_florabr(data_dir = my_dir, data_version = "Latest_available", type = "short") #short #> Loading version 393.401 colnames(bf) #See variables from short version #> [1] "species" "scientificName" "acceptedName" #> [4] "kingdom" "group" "subgroup" #> [7] "phylum" "class" "order" #> [10] "family" "genus" "lifeForm" #> [13] "habitat" "biome" "states" #> [16] "vegetation" "origin" "endemism" #> [19] "taxonomicStatus" "nomenclaturalStatus" "vernacularName" #> [22] "taxonRank" "id" ``` -------------------------------- ### Select endemic and native tree species using select_species Source: https://wevertonbio.github.io/florabr/reference/select_species.html This example demonstrates how to filter the Flora e Funga do Brasil dataset for endemic and native tree species that occur exclusively in both the Atlantic Forest and Amazon biomes. ```r data("bf_data") #Load Flora e Funga do Brasil data #'Select endemic and native species of trees with disjunct occurrence in # Atlantic Forest and Amazon am_af_only <- select_species(data = bf_data, include_subspecies = FALSE, include_variety = FALSE, kingdom = "Plantae", group = "All", subgroup = "All", phylum = "All", class ="All", order = "All", family = "All", genus = "All", lifeForm = "Tree", filter_lifeForm = "only", habitat = "All", filter_habitat = "in", biome = c("Atlantic_Forest","Amazon"), filter_biome = "only", state = "All", filter_state = "and", vegetation = "All", filter_vegetation = "in", endemism = "Endemic", origin = "Native", taxonomicStatus = "All", nomenclaturalStatus = "All") ```