Indexing and download functions

The safedata package maintains a local index of the datasets available in the SAFE dataset repository, used to check the availability of datasets and to download and verify dataset files. These commands are used to generate the local index, validate record ids against the index and to download data.

safedata

Finding and using data from the SAFE Project.

set_safe_dir()

Set the local SAFE data directory

validate_record_ids() print(<safe_record_set>) `&`(<safe_record_set>) `|`(<safe_record_set>)

Validates dataset record ids from user input

download_safe_files()

Download SAFE dataset files

set_example_safe_dir() unset_example_safe_dir()

Functions to use an example data directory for package examples

Data discovery

These functions provide an interface to the dataset metadata search API provided by the SAFE Project website

search_dates() search_fields() search_authors() search_taxa() search_text() search_spatial()

SAFE dataset search functions.

Metadata display

SAFE datasets contain a considerable amount of metadata about at the dataset, data worksheet and field level. These functions display the metadata available at each of these levels.

show_concepts() show_record() show_worksheet()

Show SAFE dataset metadata

Loading data

These functions load data from a SAFE dataset and allow users to explore the taxa and locations associated with a dataset and to match taxa and locations into a loaded data worksheet.

load_safe_data() str(<safedata>) print(<safedata>)

Loads data from a SAFE dataset.

insert_dataset()

Inserts local copies of files from a dataset into a SAFE data directory

get_taxa()

Obtaining taxonomy for a SAFE dataset.

get_taxon_coverage()

Retrieve the current taxon index

igraph_to_phylo() get_phylogeny()

Getting a phylogeny for a dataset

get_taxon_graph()

Get a graph of the taxa in a dataset

add_taxa()

Add a taxonomic hierarchy to a SAFE data worksheet.

get_locations()

Obtaining locations for a SAFE dataset.

add_locations()

Adds location data to a SAFE data worksheet.

Accessing files

These functions help users get access to the files stored in a safedata directory.

get_file_details()

Get file details for a record

Internal functions

The following internal functions are not included in the package namespace but are documented here briefly.

safedata_env

Index file memory cache

get_data_dir()

Checks the data directory is set and returns it

verbose_message()

Message function that can be globally muted

download_index()

Downloads the current dataset index

download_gazetteer()

Downloads the current SAFE gazetteer

download_location_aliases()

Downloads the current SAFE location aliases

load_index()

Load and cache the dataset index

load_gazetteer()

Load and cache the SAFE gazetteer

load_location_aliases()

Load and cache the SAFE location aliases

fetch_record_metadata() load_record_metadata()

Get and load SAFE dataset metadata

safe_api_search() validate_query_param()

Internal SAFE dataset API search functions

taxon_index_to_taxon_table()

Add taxon hierarchy to taxon metadata

try_to_download()

Attempt to download a URL resource, failing gracefully.

safedata_network

Network resources and the safedata package.