Title: | 'Native Status Resolver' |
---|---|
Description: | Provides access to the 'Native Status Resolver' (NSR) <https://github.com/ojalaquellueva/nsr> API through R. The user supplies plant taxonomic names and political divisions and the package returns information about their likely native status (e.g., native, non-native,endemic), along with information on how those decisions were made. |
Authors: | Brian Maitner [aut, cre], Brad Boyle [aut] |
Maintainer: | Brian Maitner <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-16 05:52:00 UTC |
Source: | https://github.com/cran/NSR |
NSR returns information on native status for species within a political region.
NSR(occurrence_dataframe, ...)
NSR(occurrence_dataframe, ...)
occurrence_dataframe |
A properly formatted dataframe, see https://bien.nceas.ucsb.edu/bien/tools/nsr/batch-mode/ |
... |
Additional arguments passed to internal functions. |
Dataframe containing NSR results.
## Not run: results <- NSR(occurrence_dataframe = nsr_testfile) # Inspect the results head(results, 10) # That's a lot of columns. Let's display one row vertically # to get a better understanding of the output fields results.t <- t(results[,2:ncol(results)]) results.t[,1,drop =FALSE] # Summarize the main results results[ 1:10, c("species", "country", "state_province", "native_status", "native_status_reason")] # Compare summary flag isIntroduced to more detailed native_status values # and inspect souces consulted results[ 1:10, c("species", "country", "state_province", "native_status", "isIntroduced", "native_status_sources")] ## End(Not run)
## Not run: results <- NSR(occurrence_dataframe = nsr_testfile) # Inspect the results head(results, 10) # That's a lot of columns. Let's display one row vertically # to get a better understanding of the output fields results.t <- t(results[,2:ncol(results)]) results.t[,1,drop =FALSE] # Summarize the main results results[ 1:10, c("species", "country", "state_province", "native_status", "native_status_reason")] # Compare summary flag isIntroduced to more detailed native_status values # and inspect souces consulted results[ 1:10, c("species", "country", "state_province", "native_status", "isIntroduced", "native_status_sources")] ## End(Not run)
Returns information needed to cite the NSR
NSR_citations(...)
NSR_citations(...)
... |
Additional arguments passed to internal functions. |
Dataframe containing bibtex-formatted citation information
This function provides citation information in bibtex format that can be used with reference manager software (e.g. Paperpile, Zotero). Please do remember to cite both the sources and the NSR, as the NSR couldn't exist without these sources!
{ citation_info <- NSR_citations() }
{ citation_info <- NSR_citations() }
Returns information from the NSR data dictionary
NSR_data_dictionary(native_status = FALSE, ...)
NSR_data_dictionary(native_status = FALSE, ...)
native_status |
Logical. If FALSE(Default) returns information on fields. If TRUE, returns information on Native Status categories. |
... |
Additional arguments passed to internal functions. |
Data.frame containing requested data dictionary contents.
{ NSR_fields <- NSR_data_dictionary() status_codes <- NSR_data_dictionary(native_status = TRUE) }
{ NSR_fields <- NSR_data_dictionary() status_codes <- NSR_data_dictionary(native_status = TRUE) }
Returns metadata on NSR including version and citation information
NSR_metadata(bibtex_file = NULL, ...)
NSR_metadata(bibtex_file = NULL, ...)
bibtex_file |
Optional output file for writing bibtex citations. |
... |
Additional arguments passed to internal functions. |
List containing: (1) bibtex-formatted citation information, (2) information about NSR data sources, and (3) NSR version information.
This function provides citation information in bibtex format that can be used with reference manager software (e.g. Paperpile, Zotero). Please remember to cite both the sources and the NSR, as the NSR couldn't exist without these sources!
This function is a wrapper that returns the output of the functions NSR_citations, NSR_sources, and NSR_version.
{ metadata <- NSR_metadata() }
{ metadata <- NSR_metadata() }
NSR_political_divisions returns information on political divisions with checklist information present in the NSR.
NSR_political_divisions(by_country = TRUE, ...)
NSR_political_divisions(by_country = TRUE, ...)
by_country |
Logical. If TRUE (the default), will return a data.frame of checklists for each country. If FALSE, will return a data.frame of countries for each checklist. |
... |
Additional parameters passed to internal functions. |
data.frame containing information on political divisions within the NSR database.
Setting checklist to FALSE returns a list of political divisions that can be used to standardize spellings.
## Not run: #To get a list of all political divisions with comprehensive checklists: checklists_per_country <- NSR_political_divisions() #To get a list of all checklists the associated countries, set "by_country" to FALSE countries_per_checklist <- NSR_political_divisions(by_country=FALSE) ## End(Not run)
## Not run: #To get a list of all political divisions with comprehensive checklists: checklists_per_country <- NSR_political_divisions() #To get a list of all checklists the associated countries, set "by_country" to FALSE countries_per_checklist <- NSR_political_divisions(by_country=FALSE) ## End(Not run)
NSR_simple returns information on native status for species within a political region.
NSR_simple( species = NULL, country = NULL, state_province = NULL, county_parish = NULL, ... )
NSR_simple( species = NULL, country = NULL, state_province = NULL, county_parish = NULL, ... )
species |
A single species or a vector of species, with genus and specific epithet separated by a space. |
country |
A single country or a vector of countries. If a vector, length must equal length of species vector. |
state_province |
A single state/province or a vector of states. If a vector, length must equal length of species vector. |
county_parish |
A single county/parish or a vector of counties. If a vector, length must equal length of species vector. |
... |
Additional arguments passed to internal functions. |
Dataframe containing NSR results.
## Not run: results <- NSR_simple(species = "Acer rubrum", country = "Canada",state_province = "Ontario") results <- NSR_simple(species = c("Acer rubrum", "Aspen tremuloides") , country = c("Canada","Canada"),state_province = c("Ontario","Ontario")) ## End(Not run)
## Not run: results <- NSR_simple(species = "Acer rubrum", country = "Canada",state_province = "Ontario") results <- NSR_simple(species = c("Acer rubrum", "Aspen tremuloides") , country = c("Canada","Canada"),state_province = c("Ontario","Ontario")) ## End(Not run)
Return metadata about the current NSR sources
NSR_sources(...)
NSR_sources(...)
... |
Additional arguments passed to internal functions. |
Dataframe containing information about the sources used in the current NSR version.
{ sources <- NSR_sources() }
{ sources <- NSR_sources() }
NSR_template builds a template that can be populated to submit an NSR query.
NSR_template(nrow = 1)
NSR_template(nrow = 1)
nrow |
The number of rows to include in the template |
Template data.frame that can be populated and then used in NSR queries.
## Not run: template<-NSR_template(nrow = 2) template$genus<-"Acer" template$species<-c("Acer rubrum", "Acer saccharum") template$country<-"Canada" template$user_id<-1:2 results <- NSR(occurrence_dataframe = template) ## End(Not run)
## Not run: template<-NSR_template(nrow = 2) template$genus<-"Acer" template$species<-c("Acer rubrum", "Acer saccharum") template$country<-"Canada" template$user_id<-1:2 results <- NSR(occurrence_dataframe = template) ## End(Not run)
A sample dataset showing the proper formatting of NSR inputs.
nsr_testfile
nsr_testfile
A data.frame with 22 observations of 5 variables:
taxon, "Genus species" format, with specific epithet optional
country that a species occurs within
state/province that a species occurs within
county/parish that a species occurs within
unique numeric ID that can be used to link to original dataset
...
Return metadata about the current NSR version
NSR_version(...)
NSR_version(...)
... |
Additional arguments passed to internal functions. |
Dataframe containing current NSR version number, build date, and code version.
{ NSR_version_metadata <- NSR_version() }
{ NSR_version_metadata <- NSR_version() }