search_datasets: Query datasets

View source: R/search_datasets.R

search_datasetsR Documentation

Query datasets

Description

Identify relevant datasets using a keyword or a custom query. If the query is a character string, then all character columns in the table are searched and the entries for which at least one partial match was found are returned. Alternatively, a named list can be used to look for an exact match in a specific column (see Details section).

Usage

search_datasets(query, verbose = TRUE, ...)

Arguments

query

either a character string including a single keyword or a named list containing a custom query (see details section below). Note that if an empty character string is passed, then all datasets available are returned.

verbose

a logical. Should extra information be reported on progress?

...

further arguments to be passed to httr::GET().

Details

If query is a named list, the name used should be one of the following:

  • id: unique identifier of the dataset

  • name: name of the dataset

  • date: date (YYYY-mm-dd) of the corresponding publication

  • description: a brief description of the data set

  • ref_id: the Mangal identifier of the dataset

Note that for lists with more than one element, only the first element is used, the others are ignored. Examples covering custom queries are provided below.

Value

An object of class mgSearchDatasets, which basically is a data.frame object including all datasets corresponding to the query. For each dataset entry, the networks and the original reference are attached.

References

Examples


 # Return all datasets (takes time)
 all_datasets <- search_datasets("")
 all_datasets
 class(all_datasets)
 # Search with keyword
 mg_lagoon <- search_datasets(query = 'lagoon')
 # Search with a custom query (specific column)
 mg_kemp <- search_datasets(query = list(name = 'kemp_1977'))
 mg_16 <- search_datasets(query = list(ref_id = 16))


rmangal documentation built on March 31, 2023, 10:27 p.m.