knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This tutorial explains how to use our reptile taxonomy functions to format and access structured information about reptile species in your research or applications.
Our package provides two main functions for working with reptile taxonomic data:
format_all_attributes()
format_selected_attributes()
These functions help researchers efficiently organize and access taxonomic information about reptile species from various sources into standardized formats.
format_all_attributes()
The format_all_attributes()
function processes a complete reptile dataset and formats all available taxonomic attributes into structured tibbles (data frames).
format_all_attributes(reptile_data)
reptile_data
: A dataframe or list containing raw reptile taxonomic informationThe function returns a list of tibbles, with each tibble containing a specific category of taxonomic information:
distribution
: Geographic distribution informationsynonyms
: Scientific name synonyms throughout taxonomic historyhigher_taxa
: Taxonomic classification hierarchysubspecies
: Information about recognized subspeciescommon_names
: Common names in different languagesreproduction
: Reproductive biology informationtypes
: Type specimen informationdiagnosis
: Diagnostic morphological featurescomments
: Additional taxonomic notesetymology
: Origin and meaning of scientific namesreferences
: Scientific literature referenceslibrary(reptiledbr) species_list <- c( "Lachesis muta", "Python bivittatus", "Crotalus atrox", "Bothrops atrox insularis", # Trinomial (con subespecie) - deberÃa dar error "Lachesis sp" ) # reptile_data <- get_reptiledb_data(species_list) # reptile_data # Format all attributes all_attributes <- format_all_attributes(reptile_data) # Access specific attribute categories all_attributes$distribution all_attributes$common_names
format_selected_attributes()
If you only need specific taxonomic attributes, the format_selected_attributes()
function allows you to extract only the categories you're interested in.
format_selected_attributes(reptile_data, attributes, quiet = FALSE)
reptile_data
: A dataframe or list containing raw reptile taxonomic informationattributes
: A character vector listing the specific attributes to extractquiet
: Logical value. If TRUE, suppresses processing messagesReturns a list containing only the requested attribute tibbles.
# Extract only synonyms, higher taxa, and common names selected_info <- format_selected_attributes( reptile_data = reptile_data, attributes = c("Synonym", "Higher Taxa", "Common Names"), quiet = TRUE ) # Access the selected information selected_info$Synonym selected_info$`Higher Taxa` selected_info$`Common Names`
Once you have formatted your reptile data, you can use standard R data manipulation techniques to analyze the information:
# Find all venomous species all_attributes$comments |> dplyr::filter(stringr::str_detect(comment_detail, "Venomous")) # Extract distribution information for a specific species all_attributes$distribution |> dplyr::filter(input_name == "Crotalus atrox")
Each formatted attribute tibble includes at least these standard columns:
input_name
: The original species name providedgenus
: The genus namespecies
: The species epithetdistribution
, common_name
, synonym
, etc.)This consistent structure allows for easy filtering, joining, and analysis across different attribute categories.
format_selected_attributes()
to improve performanceinput_name
column provides a reliable key for joining information across different attribute tibblesBy effectively using these formatting functions, you can streamline your reptile taxonomic research and data analysis workflows.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.