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)

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

Arguments

query

either a character string including a single keyword or a 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().

Value

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

Details

Names of the list should match one of the column names within the table. For the dataset table, those are:

  • 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.

References

Metadata available at https://mangal-wg.github.io/mangal-api/#datasets

Examples

# \donttest{ # Return all datasets (takes time) all_datasets <- search_datasets("", verbose = FALSE) all_datasets
#> # A tibble: 173 x 10 #> id name description public created_at updated_at ref_id user_id #> <int> <chr> <chr> <lgl> <chr> <chr> <int> <int> #> 1 2 howk… Insect act… TRUE 2019-02-2… 2019-02-2… 2 2 #> 2 7 lund… Pollnator … TRUE 2019-02-2… 2019-02-2… 7 2 #> 3 9 elbe… Flower-vis… TRUE 2019-02-2… 2019-02-2… 9 2 #> 4 14 john… Predation … TRUE 2019-02-2… 2019-02-2… 14 3 #> 5 15 have… Pelagic co… TRUE 2019-02-2… 2019-02-2… 15 3 #> 6 16 kemp… Food web f… TRUE 2019-02-2… 2019-02-2… 16 3 #> 7 17 brad… Food web o… TRUE 2019-02-2… 2019-02-2… 17 3 #> 8 18 patt… Food web o… TRUE 2019-02-2… 2019-02-2… 18 3 #> 9 19 clar… Food web o… TRUE 2019-02-2… 2019-02-2… 19 3 #> 10 20 van_… Food web o… TRUE 2019-02-2… 2019-02-2… 20 3 #> # … with 163 more rows, and 2 more variables: references <list>, #> # networks <list>
class(all_datasets)
#> [1] "tbl_df" "tbl" "data.frame" "mgSearchDatasets"
# } # Search with keyword mg_lagoon <- search_datasets(query = 'lagoon', verbose = FALSE) # Search with a custom query (specific column) mg_kemp <- search_datasets(query = list(name = 'kemp_1977'), verbose = FALSE) mg_16 <- search_datasets(query = list(ref_id = 16), verbose = FALSE)