### Install rglobi Development Version Source: https://github.com/ropensci/rglobi/blob/main/README.md Install the latest development version of the rglobi package from GitHub using the devtools package. ```R install.packages("devtools") devtools::install_github("ropensci/rglobi") ``` -------------------------------- ### Install rglobi from CRAN Source: https://github.com/ropensci/rglobi/blob/main/README.md Use this command to install the stable version of the rglobi package from CRAN. ```R install.packages("rglobi") ``` -------------------------------- ### Example Interaction Data for Rattus rattus Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md This output shows a sample of interactions involving Rattus rattus, including source and target taxa, their paths, and interaction types. It serves as an example of the data structure returned by interaction queries. ```text ## source_taxon_external_id source_taxon_name ## 1 EOL:328447 Rattus rattus ## 2 EOL:328447 Rattus rattus ## 3 EOL:328447 Rattus rattus ## 4 EOL:328447 Rattus rattus ## 5 EOL:328447 Rattus rattus ## 6 EOL:328447 Rattus rattus ## source_taxon_path ## 1 Animalia | Bilateria | Deuterostomia | Chordata | Vertebrata | Gnathostomata | Tetrapoda | Mammalia | Theria | Eutheria | Rodentia | Myomorpha | Muridae | Murinae | Rattus | Rattus rattus ## 2 Animalia | Bilateria | Deuterostomia | Chordata | Vertebrata | Gnathostomata | Tetrapoda | Mammalia | Theria | Eutheria | Rodentia | Myomorpha | Muridae | Murinae | Rattus | Rattus rattus ## 3 Animalia | Bilateria | Deuterostomia | Chordata | Vertebrata | Gnathostomata | Tetrapoda | Mammalia | Theria | Eutheria | Rodentia | Myomorpha | Muridae | Murinae | Rattus | Rattus rattus ## 4 Animalia | Bilateria | Deuterostomia | Chordata | Vertebrata | Gnathostomata | Tetrapoda | Mammalia | Theria | Eutheria | Rodentia | Myomorpha | Muridae | Murinae | Rattus | Rattus rattus ## 5 Animalia | Bilateria | Deuterostomia | Chordata | Vertebrata | Gnathostomata | Tetrapoda | Mammalia | Theria | Eutheria | Rodentia | Myomorpha | Muridae | Murinae | Rattus | Rattus rattus ## 6 Animalia | Bilateria | Deuterostomia | Chordata | Vertebrata | Gnathostomata | Tetrapoda | Mammalia | Theria | Eutheria | Rodentia | Myomorpha | Muridae | Murinae | Rattus | Rattus rattus ## source_specimen_life_stage interaction_type target_taxon_external_id ## 1 NA interactsWith EOL:13340393 ## 2 NA interactsWith EOL:10702710 ## 3 NA interactsWith EOL:5004474 ## 4 NA interactsWith EOL:4968671 ## 5 NA interactsWith EOL:4965412 ## 6 NA interactsWith EOL:4963889 ## target_taxon_name ## 1 Mastophorus muris ## 2 Trypanosoma lewisi ## 3 Calodium hepaticum ## 4 Raillietina ## 5 Nippostrongylus brasiliensis ## 6 Syphacia ## target_taxon_path ## 1 Animalia | Nematoda | Secernentea | Spirurida | Spiruridae | Mastophorus | Mastophorus muris ## 2 Cellular organisms | Eukaryota | Euglenozoa | Kinetoplastida | Trypanosomatidae | Trypanosoma | Herpetosoma | Trypanosoma lewisi ## 3 Calodium hepaticum ## 4 Animalia | Platyhelminthes | Cestoda | Cyclophyllidea | Davaineidae | Raillietina ## 5 Animalia | Nematoda | Secernentea | Strongylida | Heligosomidae | Nippostrongylus | Nippostrongylus brasiliensis ## 6 Animalia | Nematoda | Secernentea | Ascaridida | Oxyuridae | Syphacia ## target_specimen_life_stage latitude longitude study_title ## 1 NA NA NA NA ## 2 NA NA NA NA ## 3 NA NA NA NA ## 4 NA NA NA NA ## 5 NA NA NA NA ## 6 NA NA NA NA ``` -------------------------------- ### Run Package Tests Source: https://github.com/ropensci/rglobi/blob/main/README.md Install package dependencies and execute all test cases using devtools. Ensure the working directory is the repository root. ```R # workdir should be rglobi repo root directory (check with getwd()) # install dependencies devtools::install('.') devtools::test() ``` -------------------------------- ### Get Supported Interaction Types Source: https://github.com/ropensci/rglobi/blob/main/README.md Retrieve a list of all supported interaction types available in the rglobi database. ```R get_interaction_types() ``` -------------------------------- ### Get Interactions with Observations Source: https://github.com/ropensci/rglobi/blob/main/README.md Retrieve bird-rodent predation interactions within a specific bounding box in California, returning observations with latitude and longitude. ```R obs <- get_interactions_by_taxa(sourcetaxon = "Aves", bbox=c(-125.53344800000002,32.750323,-114.74487299999998,41.574361), targettaxon = "Rodentia", returnobservations=TRUE) locations <- cbind(obs$target_taxon_name, obs$latitude, obs$longitude) ``` -------------------------------- ### Get prey of a species in R Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Use `get_prey_of()` to find species that are prey to a given species. This function is a wrapper for `get_interactions()` and simplifies the query. ```r hsapiens <- get_prey_of("Homo sapiens") head(hsapiens) ``` -------------------------------- ### Get All Interaction Areas Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Retrieve a list of all geographic coordinates for which interaction data is available in GloBi. The output includes latitude and longitude for each point. ```r areas <- get_interaction_areas() head(areas) ``` -------------------------------- ### Generate Documentation with roxygen2 Source: https://github.com/ropensci/rglobi/blob/main/README.md Use roxygen2 to generate the package's .Rd files and NAMESPACE file by running roxygenize in the package root directory. ```R library(roxygen2) roxygenize(".") ``` -------------------------------- ### Load rglobi Package Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Loads the rglobi library into the R session. This is necessary before using any of its functions. ```r library("rglobi") ``` -------------------------------- ### Accessing Taxonomies by Provider and Level in R Source: https://github.com/ropensci/rglobi/wiki/R-data-sets-structure-(proposal) Shows how to filter the 'taxonomy' list by both provider and taxonomic level, allowing for more specific data retrieval. ```R gloBItaxonomies$taxonomy[gloBItaxonomies$provider == "provider1" & gloBItaxonomies$level == "phylum"] ``` -------------------------------- ### Accessing Taxonomies by Provider in R Source: https://github.com/ropensci/rglobi/wiki/R-data-sets-structure-(proposal) Demonstrates how to filter the 'taxonomy' list within the 'gloBItaxonomies' structure to retrieve entries associated with a specific provider. ```R gloBItaxonomies$taxonomy[gloBItaxonomies$provider == "provider1"] ``` -------------------------------- ### Define and Use R Function Source: https://github.com/ropensci/rglobi/wiki/Home Defines a simple R function 'AddOne' that increments its input by one and then calls it with an argument. ```R AddOne <- function(x) { x + 1 } a <- AddOne(1) ``` -------------------------------- ### Find Interactions for a Specific Taxon Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Fetches all interactions where 'Rattus' is either a source or target taxon. The output includes details about the interaction type, source, target, and study information. ```r rattus <- get_interactions_by_taxa(sourcetaxon = "Rattus") head(rattus) ``` -------------------------------- ### Find Interactions by Taxa and Bounding Box Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Use this function to retrieve interactions between specified source and target taxa within a given bounding box. Coordinates must be in decimal degrees (min x, min y, max x, max y). ```r aves_crustacea_northern_hemisphere <- get_interactions_by_taxa( sourcetaxon = "Aves", targettaxon = "Crustacea", bbox=c(-180, 0, 180, 90 )) head(aves_crustacea_northern_hemisphere) ``` -------------------------------- ### R List Structure for Taxonomies Data Source: https://github.com/ropensci/rglobi/wiki/R-data-sets-structure-(proposal) Proposes a list structure for the 'Taxonomies' data set to handle variable taxonomic levels and compositions. It includes fields for ID, provider, level, and a list of data frames for taxonomic ranks and names. ```R gloBItaxonomies <- list( id = c("id1", "id2", "id3", …), provider = c("provider1", "provider2", "provider1", …), level = c("class", "phylum", "kingdom", …), taxonomy = list( data.frame( rank = c("Kingdom","Phylum","Class"), name = c("Animalia","Chordata","Aves") ), data.frame( rank = c("Kingdom","Phylum"), name = c("Animalia","Chordata") ), data.frame( rank = c("Kingdom"), name = c("Animalia") ), … ) ) ``` -------------------------------- ### Find Interactions in a Geographic Area Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Use `get_interactions_in_area` to retrieve all interactions within a specified rectangular bounding box. Coordinates must be in decimal degrees (min x, min y, max x, max y). ```r gulfinteractions <- get_interactions_in_area( bbox=c(-97.0, 17.5, -81, 31)) head(gulfinteractions) ``` -------------------------------- ### Find Prey of a Species Source: https://github.com/ropensci/rglobi/blob/main/README.md Find all unique prey names for a given species. This is a shortcut for get_interactions_by_taxa with interactiontype='preysOn'. ```R library(rglobi) # find all unique prey names of Homo sapiens prey_of("Homo sapiens")$target_taxon_name # is a shortcut of get_interactions_by_taxa(sourcetaxon='Homo sapiens', interactiontype='preysOn')$target_taxon_name ``` -------------------------------- ### Find Interactions for a Species Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Retrieves biotic interactions for a specified taxon and interaction type. The taxon can be a scientific name or a higher taxonomic rank. The output includes details about the source and target taxa involved in the interaction. ```r hsapiens <- get_interactions(taxon = "Homo sapiens", interaction.type = "preysOn") head(hsapiens) ``` -------------------------------- ### Filter Interaction Areas by Bounding Box Source: https://github.com/ropensci/rglobi/blob/main/inst/vign/rglobi_vignette.md Retrieve interaction areas that fall within a specified bounding box. This function allows for a more targeted search of available interaction locations. ```r areas <- get_interaction_areas (bbox=c(-67.87,12.79,-57.08,23.32)) head(areas) ``` -------------------------------- ### R Data Frame for Interactions Data Source: https://github.com/ropensci/rglobi/wiki/R-data-sets-structure-(proposal) Defines the structure of the 'Interactions' data frame, including columns for interaction details, source and target IDs, life stages, habitats, location, time, and source. ```R gloBIinteractions <- data.frame( interactionID = …, interactionName = …, sourceID = …, sourceNameIdentifiedAs = …, targetID = …, targetNameIdentifiedAs = …, sourceLifeStageID = …, sourceLifeStageName = …, targetLifeStageID = …, targetLifeStageName = …, habitatIDs = …, habitatNames = …, latitude = …, longitude = …, time = …, source = … ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.