From b363af468d19bc92ec8736a834cb92f04908c95e Mon Sep 17 00:00:00 2001 From: Pieter Provoost Date: Wed, 9 Oct 2024 19:35:29 +0200 Subject: [PATCH] readme --- README.md | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 1d679a2..e075fe8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ There are several options available to download data from OBIS, some of which in - R package [robis](https://github.com/iobis/robis) - Python package [pyobis](https://github.com/iobis/pyobis) -- Full data exports +- [Full data exports](#full-data-exports) - [OBIS homepage search](https://obis.org/) or [advanced dataset search](https://obis.org/datasets) - [OBIS Mapper](https://mapper.obis.org/) @@ -24,41 +24,45 @@ There are several options available to download data from OBIS, some of which in ### robis The [robis R package](https://github.com/iobis/robis) connects to the OBIS API from R. The package can be installed from CRAN or from GitHub (latest development version). -``` + +```r # install from CRAN install.packages("robis") # latest development version remotes::install_github("iobis/robis") ``` + You can use the package to obtain a list of datasets, a taxon checklist, or raw occurrence data by supplying e.g. a taxon name or [WoRMS AphiaID](https://www.marinespecies.org/about.php). You can also specify whether to include absence records when obtaining occurrence data. To download this data, simply export R objects with the write.csv function. If we wanted to obtain Mollusc data from OBIS, some options would be: -``` +```r library(robis) -#obtain occurrence data -moll<-occurrence("Mollusca") -moll_abs<-occurrence(“Mollusca”, absence="include") #include absence records -write.csv(moll, “mollusca-obis.csv”)` #save the data to csv -#obtain a list of datasets for a taxon -molldata<-dataset(scientificname="Mollusca") +# obtain occurrence data +moll <- occurrence("Mollusca") +moll_abs <- occurrence(“Mollusca”, absence = "include") # include absence records +write.csv(moll, "mollusca-obis.csv") # save the data to csv + +# obtain a list of datasets for a taxon +molldata <- dataset(scientificname = "Mollusca") #obtain a checklist of Mollusc species in a certain area -mollcheck<-checklist(scientificname="Mollusca", geometry = "POLYGON ((2.3 51.8, 2.3 51.6, 2.6 51.6, 2.6 51.8, 2.3 51.8))") +mollcheck <- checklist(scientificname = "Mollusca", geometry = "POLYGON ((2.3 51.8, 2.3 51.6, 2.6 51.6, 2.6 51.8, 2.3 51.8))") ``` #### Filter datasets by keyword You can use robis to obtain all datasets and then filter based on keywords in the title and/or abstract. See example below where we filter to find datasets related to seamounts. Multiple keywords can be provided by using | to separate each word, e.g. "seamount|deepsea|benthos". -``` -search_terms <- "seamount" #define your search terms +```r +search_terms <- "seamount" # define your search terms -datasets <- robis::dataset() #obtain datasets from OBIS +datasets <- robis::dataset() # obtain datasets from OBIS -seamount_datasets <- datasets[grepl(paste(search_terms, collapse = "|"), datasets$title, ignore.case = TRUE) | - grepl(paste(search_terms, collapse = "|"), datasets$abstract, ignore.case = TRUE),] +seamount_datasets <- datasets[ + grepl(paste(search_terms, collapse = "|"), datasets$title, ignore.case = TRUE) | + grepl(paste(search_terms, collapse = "|"), datasets$abstract, ignore.case = TRUE),] ``` ## Full data exports