### Install florabr from GitHub Source: https://github.com/wevertonbio/florabr/blob/main/README.Rmd Installs the development version of florabr from GitHub using the remotes package, then loads it. Requires the remotes package if not already installed. ```r if(!require(remotes)){ install.packages("remotes") } if(!require(florabr)){ remotes::install_github("wevertonbio/florabr")} library(florabr) ``` -------------------------------- ### Load mapview package Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/Spatialize_florabr.Rmd Installs mapview if not already installed (note: the install.packages call incorrectly installs 'geobr' instead of 'mapview'), then loads the mapview library for interactive mapping. ```r #Install mapview if necessary and load package if(!require(mapview)){ install.packages("geobr") } #Load mapview library(mapview) ``` -------------------------------- ### Solve discrepancies with solve_discrepancies() Source: https://github.com/wevertonbio/florabr/blob/main/man/solve_discrepancies.Rd Loads the example dataset bf_data, checks its solve_discrepancies attribute, applies solve_discrepancies() to create bf_solved, then verifies the attribute on the solved data. ```r data("bf_data") #Load Flora e Funga do Brasil data #Check if discrepancies were solved in the dataset attr(bf_data, "solve_discrepancies") #Solve discrepancies bf_solved <- solve_discrepancies(bf_data) #Check if discrepancies were solved in the dataset attr(bf_solved, "solve_discrepancies") ``` -------------------------------- ### Download and load Flora e Funga do Brasil database Source: https://github.com/wevertonbio/florabr/blob/main/man/load_florabr.Rd This example shows the complete workflow of creating a directory, downloading the database with get_florabr, and then loading it with load_florabr. It is wrapped in \dontrun{} because it requires an internet connection and writes files to disk. ```R \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") } ``` -------------------------------- ### Install florabr from CRAN Source: https://github.com/wevertonbio/florabr/blob/main/README.Rmd Installs the stable version of the florabr package from CRAN. ```r install.packages("florabr") ``` -------------------------------- ### Install and load geobr package Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/Spatialize_florabr.Rmd Installs the geobr package if it is not already installed and loads it. Required to access the original, non-simplified spatial polygons of Brazilian states and biomes. ```R #Install geobr if necessary and load package if(!require(geobr)){ install.packages("geobr") } #Load geobr library(geobr) ``` -------------------------------- ### Download and merge Flora e Funga do Brasil database with get_florabr Source: https://github.com/wevertonbio/florabr/blob/main/man/get_florabr.Rd Example usage of get_florabr to download the latest database version, merge it into a single data.frame, and save it. Creates a temporary directory first, then calls the function with default options for discrepancy solving, overwriting, and verbosity. ```R \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) } ``` -------------------------------- ### Check species names with check_names Source: https://github.com/wevertonbio/florabr/blob/main/man/check_names.Rd Loads the example dataset bf_data from the florabr package and checks a vector of species names against the Flora e Funga do Brasil database using check_names with default arguments. ```r data("bf_data", package = "florabr") spp <- c("Butia cattarinensis", "Araucaria angustifolia") check_names(data = bf_data, species = spp) ``` -------------------------------- ### Get available vegetation options with get_attributes() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/selecting_species.Rmd Retrieves the list of vegetation values accepted by select_species(). The output includes categories like 'Anthropic_Area', 'Caatinga', 'Cerrado', and 'Rainforest'. ```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 ``` -------------------------------- ### Select native endemic trees in Atlantic Forest with select_species() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/selecting_species.Rmd Filters the Brazilian Flora dataset to return all native and endemic tree species with confirmed occurrences in the Atlantic Forest. The example sets lifeForm='Tree', biome='Atlantic_Forest', endemism='Endemic', origin='Native', and taxonomicStatus='Accepted'. The output shows 2372 species meet the criteria. ```r af_spp <- select_species(data = bf, include_subspecies = FALSE, include_variety = FALSE, kingdom = "Plantae", group = "All", subgroup = "All", family = "All", genus = "All", lifeForm = "Tree", #Specify tree species filter_lifeForm = "in", habitat = "All", filter_habitat = "in", biome = "Atlantic_Forest", #Occuring in the At. Forest filter_biome = "in", #In Atlantic Forest state = "All", filter_state = "in", vegetation = "All", filter_vegetation = "in", endemism = "Endemic", #Only endemics to Brazil origin = "Native", #Only natives taxonomicStatus = "Accepted", nomenclaturalStatus = "All") nrow(af_spp) #> [1] 2372 ``` -------------------------------- ### Import and subset occurrence data Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/Spatialize_florabr.Rmd Loads the 'occurrences' example dataset from the florabr package and subsets it to the two species of interest. The head(occ) output shows the first six rows with columns species, x (longitude), and y (latitude). ```r data("occurrences") #select Abatia americana and Araucaria angustifolia from the dataset occ <- subset(occurrences, occurrences$species %in% my_spp) head(occ) #> species x y #> 1 Araucaria angustifolia -51.15749 -29.58290 #> 2 Araucaria angustifolia -50.02454 -28.44414 #> 3 Araucaria angustifolia -46.77204 -23.45729 #> 4 Araucaria angustifolia -48.98117 -25.49632 #> 5 Araucaria angustifolia -54.50869 -25.55113 #> 6 Araucaria angustifolia -50.92680 -27.01826 ``` -------------------------------- ### Get and plot spatial polygons of species with get_spat_occ Source: https://github.com/wevertonbio/florabr/blob/main/man/get_spat_occ.Rd Loads Flora e Funga do Brasil data and retrieves spatial polygons (SpatVectors) for example species. The function returns a list with states, biomes, and their intersection, which are then plotted for the first species. ```R library(terra) 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) #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) ``` -------------------------------- ### Extract species subset with subset_species Source: https://github.com/wevertonbio/florabr/blob/main/man/subset_species.Rd Loads the example dataset bf_data, defines a vector of species names, and calls subset_species to extract those species. 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 ``` -------------------------------- ### Get available Biome options with get_attributes() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/selecting_species.Rmd Retrieves the list of biome values accepted by select_species(). The output includes 'Amazon', 'Atlantic_Forest', 'Caatinga', 'Cerrado', 'Pampa', 'Pantanal', and 'Not_found_in_brazil'. ```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 ``` -------------------------------- ### Get available lifeForm options with get_attributes() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/selecting_species.Rmd Retrieves the list of lifeForm values accepted by select_species(). The output shows the available categories, including 'Tree', 'Shrub', and 'Herb'. ```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 ``` -------------------------------- ### Get available biomes, life forms and states with get_attributes Source: https://github.com/wevertonbio/florabr/blob/main/man/get_attributes.Rd Loads the bf_data dataset and retrieves available options for biome, lifeform, and states to use with select_species. The attribute argument accepts multiple options as a character vector. ```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")) ``` -------------------------------- ### Save Brazilian Flora data to CSV with write.csv() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_started.Rmd Saves the loaded data frame (e.g., bf) as a CSV file using write.csv(). The file is saved to the specified directory with the filename 'BrazilianFlora.csv'. This example is not executed (eval=FALSE) and is intended for external editing. ```r write.csv(x = bf, file = file.path(my_dir, "BrazilianFlora.csv"), row.names = F) ``` -------------------------------- ### Search for taxa by vernacular name with select_by_vernacular Source: https://github.com/wevertonbio/florabr/blob/main/man/select_by_vernacular.Rd Loads the Flora e Funga do Brasil dataset and demonstrates both exact and non-exact searches for the vernacular name 'pinheiro'. The exact search returns only species known as 'pinheiro', while the non-exact search also returns names like 'pinheiro-do-parana'. The example shows the result of the exact search and the head of the non-exact results. ```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 #Search for species whose vernacular name is 'pinheiro', allowing non-exact #matches pinheiro_not_exact <- select_by_vernacular(data = bf_data, names = "pinheiro", exact = FALSE) head(pinheiro_not_exact) ``` -------------------------------- ### Filter occurrences with filter_florabr Source: https://github.com/wevertonbio/florabr/blob/main/man/filter_florabr.Rd Loads example data and filters occurrences for the species 'Myrcia hatschbachii' using default buffers and flags/cleans records. The verbose argument is set to FALSE to run silently. ```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) ``` -------------------------------- ### Get presence-absence matrix for Amazon endemic trees Source: https://github.com/wevertonbio/florabr/blob/main/man/get_pam.Rd Loads the Flora e Funga do Brasil dataset, filters endemic native tree species occurring only in the Amazon biome using select_species(), then generates a presence-absence matrix with get_pam() including richness summary and spatial richness with a plot. ```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) ``` -------------------------------- ### Retrieve synonyms with get_synonym() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/selecting_species.Rmd Retrieves all synonyms for a species list using get_synonym() from the florabr package. The function requires a data object (bf) containing Flora e Funga do Brasil data and a character vector of species names. The output is a data frame with columns for synonym, acceptedName, taxonomicStatus, and nomenclaturalStatus. In this example, Araucaria angustifolia has 12 synonyms and Adesmia paranensis has one. ```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 ``` -------------------------------- ### Download florabr data with get_florabr() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_pam.Rmd Creates a temporary directory and downloads the latest version of the florabr data using get_florabr(). The overwrite = T argument ensures existing data is replaced. ```r my_dir <- file.path(file.path(tempdir(), "florabr")) dir.create(my_dir) get_florabr(output_dir = my_dir, #directory to save the data data_version = "latest", #get the most recent version available overwrite = T) #Overwrite data, if it exists ``` -------------------------------- ### Check available Flora data versions with check_version Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_started.Rmd Lists the versions of Flora e Funga do Brasil available in the specified directory. The output shows the versions found and indicates the latest one. ```r check_version(data_dir = my_dir) #> You have the following versions of Flora e Funga do Brasil: #> 393.385 #> 393.401 #> It includes the latest version: 393.401 ``` -------------------------------- ### get_florabr(output_dir, data_version = "latest", solve_discrepancy = FALSE, overwrite = TRUE, verbose = TRUE, remove_files = TRUE) Source: https://github.com/wevertonbio/florabr/blob/main/man/get_florabr.Rd Documentation for the get_florabr function, which downloads and merges the Flora e Funga do Brasil database. ```APIDOC ## get_florabr(output_dir, data_version = "latest", solve_discrepancy = FALSE, overwrite = TRUE, verbose = TRUE, remove_files = TRUE) ### Description Downloads the latest or an older version of the Flora e Funga do Brasil database, merges the information into a single data.frame, and saves this data.frame in the specified directory. ### Method Function call (R) ### Endpoint N/A - This is an R function, not an HTTP endpoint. ### Parameters - **output_dir** (character) - Required - A directory to save the data downloaded from Flora e Funga do Brasil. - **data_version** (character) - Optional - Version of the Flora e Funga do Brasil database to download. Use "latest" to get the most recent version, updated weekly. Alternatively, specify an older version (e.g., data_version = "393.319"). Default value is "latest". - **solve_discrepancy** (logical) - Optional - Resolve discrepancies between species and subspecies/varieties information. When set to TRUE, species information is updated based on unique data from varieties and subspecies. For example, if a subspecies occurs in a certain biome, it implies that the species also occurs in that biome. Default = FALSE. - **overwrite** (logical) - Optional - If TRUE, data is overwritten. Default = TRUE. - **verbose** (logical) - Optional - Whether to display messages during function execution. Set to TRUE to enable display, or FALSE to run silently. Default = TRUE. - **remove_files** (logical) - Optional - Whether to remove the downloaded files used in building the final dataset. Default is TRUE. ### Request Example ```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) #Download, merge and save data get_florabr(output_dir = my_dir, data_version = "latest", solve_discrepancy = FALSE, overwrite = TRUE, verbose = TRUE) ``` ### Response #### Success Response - The function downloads the latest version of the Flora e Funga do Brasil database from the official source. It then merges the information into a single data.frame, containing details on species, taxonomy, occurrence, and other relevant data. - The merged data.frame is then saved as a file in the specified output directory. The data is saved in a format that allows easy loading using the `load_florabr` function for further analysis in R. #### Response Example No explicit response example is provided in the source documentation. ``` -------------------------------- ### Load complete version of Brazilian Flora data with load_florabr() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_started.Rmd Loads the 'complete' version of the Brazilian Flora dataset (39 columns) using load_florabr(). The output shows the column names of the complete version, which includes 20 additional columns compared to 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" ``` -------------------------------- ### Create directory for florabr data Source: https://github.com/wevertonbio/florabr/blob/main/README.Rmd Creates a directory to store the downloaded 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) ``` -------------------------------- ### 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) Source: https://github.com/wevertonbio/florabr/blob/main/man/get_pam.Rd This function generates a presence-absence matrix of species based on their distribution across states, biomes, and vegetation types according to Flora e Funga do Brasil. It allows customization of grouping, removal of empty sites, and optional richness summaries and spatial plots. ```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. ### Method Function call ### Endpoint R function: get_pam ### Parameters - **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. ### Return 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. ### Example ```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) ``` ``` -------------------------------- ### Load short version of Brazilian Flora data with load_florabr() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_started.Rmd Loads the 'short' version of the Brazilian Flora dataset (23 columns) using load_florabr(). 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" ``` -------------------------------- ### load_florabr Source: https://github.com/wevertonbio/florabr/blob/main/man/load_florabr.Rd Loads the Flora e Funga do Brasil database from a local directory, returning a data.frame with the specified version and column set. ```APIDOC ## load_florabr(data_dir, data_version = "Latest_available", type = "short", verbose = TRUE) ### Description Loads the Flora e Funga do Brasil database from a local directory. The function returns a data.frame with the specified version of the database, which is necessary for most functions in the package. ### Parameters - **data_dir** (character) - Required - The 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 the database to load. Can be "Latest_available" to load the latest version, or a specific version string (e.g., "393.364"). Default = "Latest_available". - **type** (character) - Optional - Determines the number of columns loaded. Can be "short" (20 columns) or "complete" (39 columns). Default = "short". - **verbose** (logical) - Optional - Whether to display messages during execution. Set to TRUE to enable display, or FALSE to run silently. Default = TRUE. ### Return Value A data.frame with the specified version of the Flora e Funga do Brasil database. If type = "short", it contains the 20 columns: 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 contains all 39 variables available in the database. ### Example ```r # Load the latest available version with short format df <- load_florabr(data_dir = "path/to/data", data_version = "Latest_available", type = "short", verbose = TRUE) ``` ``` -------------------------------- ### Get spatial polygons with get_spat_occ Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/Spatialize_florabr.Rmd Extracts spatial polygons (SpatVectors) for the distribution of given species. Setting `state`, `biome`, and `intersection` to `TRUE` returns federal states, biomes, and their intersection, respectively. The `verbose = TRUE` option prints progress messages for each species. ```r #Example species spp <- c("Araucaria angustifolia", "Adesmia paranensis") #Get spatial polygons spp_spt <- get_spat_occ(data = bf, species = spp, state = TRUE, biome = TRUE, intersection = TRUE, 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 ``` -------------------------------- ### Download data with solve_discrepancy = TRUE in get_florabr() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_started.Rmd Set solve_discrepancy = TRUE in get_florabr() to resolve discrepancies during data download. The default is FALSE, so this option must be explicitly enabled. The function also accepts output_dir, data_version, overwrite, and verbose parameters. ```r get_florabr(output_dir, data_version = "latest", solve_discrepancy = TRUE, #Default is false overwrite = TRUE, verbose = TRUE) ``` -------------------------------- ### Generate a presence-absence matrix with get_pam() for Amazon trees Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_pam.Rmd Loads bf_data, filters tree species endemic and native to the Amazon biome using select_species(), then calls get_pam() with by_biome and by_state enabled, remove_empty_sites = TRUE, and all return_* options set to TRUE. The output shows the first 7 rows and 5 columns of the resulting PAM as a tibble, with columns for Biome, States, and species presence (1/0). ```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 ``` -------------------------------- ### Extract binomial names with get_binomial() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/selecting_species.Rmd Extracts binomial names from complete scientific names using get_binomial(). The function removes extra spaces and returns only Genus and specificEpithet. The example includes a human species name to illustrate that non-plant names are not filtered at this stage. ```r complete_names <- c("Araucaria brasiliana var. ridolfiana (Pi.Savi) Gordon", " Solanum restingae S.Knapp", "Butia cattarinensis Noblick & Lorenzi ", "Homo sapiens") #Human specie was used just as an example that will be used to illustrate the #next function binomial_names <- get_binomial(species_names = complete_names) binomial_names #> [1] "Araucaria brasiliana" "Solanum restingae" "Butia cattarinensis" #> [4] "Homo sapiens" ``` -------------------------------- ### select_by_vernacular(data, names, exact = FALSE) Source: https://github.com/wevertonbio/florabr/blob/main/man/select_by_vernacular.Rd Documentation for the select_by_vernacular function, which searches for taxa using vernacular names in the Flora e Funga do Brasil dataset. ```APIDOC ## select_by_vernacular(data, names, exact = FALSE) ### Description Searches for taxa using vernacular names (common names) in the Flora e Funga do Brasil dataset. ### Usage select_by_vernacular(data, names, exact = FALSE) ### Arguments - **data** (data.frame) - Required - The data.frame imported with the `load_florabr` function or generated with the function `select_species`. - **names** (character) - Required - Vernacular name ("Nome comum") of the species to be searched. - **exact** (logic) - Optional - If TRUE, the function will search only for exact matches. For example, if names = "pinheiro" and exact = TRUE, the function will return only the species popularly known as "pinheiro". On the other hand, if names = "pinheiro" and exact = FALSE, the function will return other results as "pinheiro-do-parana". Default = FALSE. ### Value A data.frame with the species with vernacular names that match the input names. ### Examples ```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 #Search for species whose vernacular name is 'pinheiro', allowing non-exact #matches pinheiro_not_exact <- select_by_vernacular(data = bf_data, names = "pinheiro", exact = FALSE) head(pinheiro_not_exact) ``` ### References Flora e Funga do Brasil. Jardim Botânico do Rio de Janeiro. Available at: http://floradobrasil.jbrj.gov.br/ Flora e Funga do Brasil. Jardim Botânico do Rio de Janeiro. Available at: http://floradobrasil.jbrj.gov.br/ ``` -------------------------------- ### View richness summary table from get_pam() output Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/getting_pam.Rmd Displays the first 7 rows of the richness summary data frame returned by get_pam() when return_richness_summary = TRUE. The table shows the number of species per site (Biome and States combination). ```r #Visualize (as tibble) the richness summary table tibble::tibble(pam_am$Richness_summary[1:7,]) # # A tibble: 7 × 3 # Biome States Richness # # 1 Amazon AM 606 # 2 Amazon MA 34 # 3 Amazon PA 296 # 4 Amazon TO 7 # 5 Amazon MT 63 # 6 Amazon RR 45 # 7 Amazon AC 107 ``` -------------------------------- ### Load short version of florabr data with load_florabr() Source: https://github.com/wevertonbio/florabr/blob/main/README.Rmd Loads the 'short' version of the florabr dataset into the environment. By default, the function searches for the latest available version, but you can specify a version using the data_version parameter. The 'short' version contains the 19 columns required for other package functions. ```r #Load the short version bf <- load_florabr(data_dir = my_dir, data_version = "Latest_available", type = "short") #short ``` -------------------------------- ### Check species names with check_names() Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/selecting_species.Rmd Checks spelling, nomenclatural status, and taxonomic status of species names using check_names(). The function uses the previously created binomial_names and the bf database. It returns a data frame with columns including Spelling, Suggested_name, Distance (Levenshtein edit distance), taxonomicStatus, nomenclaturalStatus, acceptedName, and family. The example shows that Homo sapiens is flagged as Not_found because it is not a plant. ```r #Create example checked_names <- check_names(data = bf, species = binomial_names, max_distance = 0.1, kingdom = "Plantae") checked_names # input_name Spelling Suggested_name Distance taxonomicStatus nomenclaturalStatus acceptedName family # 1 Araucaria brasiliana Correct Araucaria brasiliana 0 Synonym Araucaria angustifolia Araucariaceae # 2 Araucaria brasiliana Correct Araucaria brasiliana 0 Synonym Illegitimate Araucaria angustifolia Araucariaceae # 3 Solanum restingae Correct Solanum restingae 0 Accepted Correct Solanum restingae Solanaceae # 4 Butia cattarinensis Probably_incorrect Butia catarinensis 1 Accepted Butia catarinensis Arecaceae # 5 Homo sapiens Not_found NA ``` -------------------------------- ### check_version(data_dir) Source: https://github.com/wevertonbio/florabr/blob/main/man/check_version.Rd Checks if the user has the latest version of the Flora e Funga do Brasil data in a specified directory. ```APIDOC ## check_version(data_dir) ### Description This function checks if you have the latest version of the Flora e Funga do Brasil data available in a specified directory. ### Method Function call ### Endpoint check_version(data_dir) ### Parameters - **data_dir** (character) - Required - The directory where the data should be located. ### Return Value A message informing whether you have the latest version of Flora e Funga do Brasil available in the data_dir. ### Example ```r # Check if there is a version of Flora e Funga do Brasil data available in the current directory check_version(data_dir = getwd()) ``` ``` -------------------------------- ### Extract binomial names with get_binomial() Source: https://github.com/wevertonbio/florabr/blob/main/man/get_binomial.Rd Defines a character vector of scientific names, including names with authors, variety, and subspecies, then passes it to get_binomial() with default options to include subspecies and variety. Assigns the result to spp_new and prints it to show the extracted binomial names. ```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 ``` -------------------------------- ### Load and plot default simplified state and biome polygons Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/Spatialize_florabr.Rmd Loads the default simplified state and biome polygons from the florabr package and plots them side by side. Use this to inspect the default spatial data before replacing it with more complex polygons. ```R data("states") states <- terra::unwrap(states) data("biomes") biomes <- terra::unwrap(biomes) par(mfrow = c(2, 1), mar = c(0, 0, 0, 0)) plot(states, main = "Brazilian states with simplified geometries") plot(biomes, main = "Brazilian biomes with simplified geometries") ``` -------------------------------- ### Run get_spat_occ with non-simplified polygons Source: https://github.com/wevertonbio/florabr/blob/main/vignettes/Spatialize_florabr.Rmd Calls get_spat_occ using the non-simplified state and biome SpatVectors. This produces more complex distribution polygons than the default simplified version. ```R spp_spt_2 <- get_spat_occ(data = bf, species = spp, state = TRUE, biome = TRUE, intersection = TRUE, state_vect = br_states, #The non-simplified Spatvector state_column = "abbrev_state", #Column name with states acronyms biome_vect = br_biomes, #The non-simplified Spatvector biome_column = "name_biome", #Column name with names of biomes verbose = TRUE) ```