check_assertions: Check assertions in occurrences object

View source: R/check_assertions.R

check_assertionsR Documentation

Check assertions in occurrences object

Description

This provides a data.frame detailing the assertions that are found in a dataset returned from occurrences.

Usage

check_assertions(x)

Arguments

x

list: an object returned from occurrences

Value

A dataframe of assertions column names, descriptions and categories/error codes. If no assertions are in the dataset, NULL is returned.

References

https://api.biodiversitydata.se/, http://records.biodiversitydata.se/ws/assertions/codes

Examples

#download species data with all possible assertions
## Not run: 
 x <- occurrences(taxon="golden plover",
                  download_reason_id=10,
                  qa=sbdi_fields("assertions")$name)
 
 asserts <- check_assertions(x) #data.frame of assertions, their description and column names
 asserts$description # List out descriptions of all (current) assertions

 tmp <- x$data[,names(x$data) %in% asserts$name] ## assertion columns from data
 which(colSums(tmp)>0) ## discard those not seen in the data

## End(Not run)

biodiversitydata-se/SBDI4R documentation built on Feb. 23, 2024, 4:15 p.m.