validate_record_ids: Validates dataset record ids from user input

Description Usage Arguments Details Value Methods (by generic) Examples

View source: R/metadata.R

Description

This takes a vector of user supplied record identifiers and validates them against the index. Typically the identifiers are provided as integers, but the function will also handle Zenodo URLs and DOIs.

Usage

1
2
3
4
validate_record_ids(record_set)

## S3 method for class 'safe_record_set'
print(x, ...)

Arguments

record_set

A vector of values containing Zenodo concept or record ids.

x

An object of class safe_record_set

...

Further arguments to print methods, unused.

Details

The function returns a data frame with class safe_record_set, containing the columns concept, record, available and, finally, mra containing the most recent available record (if any). The function can be run on an existing safe_record_set to update this information.

Note that record will be NA when a value represents a concept id. Inputs that do not match a record or concept ids are returned in the attribute mismatches of the record set.

This function is largely used internally to validate user inputs and to provide a common output for the search functions but is exported to allow users to check record ids and display summary information using the print method.

Value

An object of class safe_record_set (see Details)

Methods (by generic)

Examples

1
2
3
4
5
6
7
   safedir <- system.file('example_data_dir', package='safedata')
   set_safe_dir(safedir, update=FALSE, validate=FALSE)
   validate_record_ids(c(3247631, 3266827, 3266821, -1000))
   validate_record_ids(c('https://doi.org/10.5281/zenodo.3247631', 
                           '10.5281/zenodo.3266827', 
                           'https://zenodo.org/record/3266821',
                           'not_this_one/3266821'))

ImperialCollegeLondon/safe_data documentation built on Oct. 8, 2019, 4:27 p.m.