Download data from Pangaea.

Description

Grabs data as a dataframe or list of dataframes from a Pangaea data repository URI; see: https://www.pangaea.de/.

Usage

1
2
3
4
5
pg_cache_clear(doi = NULL, prompt = TRUE)

pg_cache_list()

pg_data(doi, overwrite = TRUE, verbose = TRUE, ...)

Arguments

doi

DOI of Pangaeae single dataset, or of a collection of datasets. Expects either just a DOI of the form 10.1594/PANGAEA.746398, or with the URL part in front, like https://doi.pangaea.de/10.1594/PANGAEA.746398

prompt

(logical) Prompt before clearing all files in cache? No prompt used when DOIs assed in. Default: TRUE

overwrite

(logical) Ovewrite a file if one is found with the same name

verbose

(logical) print information messages. Default: TRUE

...

Curl options passed on to GET

Details

Data files are stored in an operating system appropriate location. Run rappdirs::user_cache_dir("pangaear") to get the storage location on your machine.

Value

One or more items of class pangaea, each with a citation object, metadata object, and data object. Each data object is printed as a tbl_df object, but the actual object is simply a data.frame.

Author(s)

Naupaka Zimmerman

References

https://www.pangaea.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Not run: 
# a single file
res <- pg_data(doi='10.1594/PANGAEA.807580')
res
res[[1]]$doi
res[[1]]$citation
res[[1]]$meta
res[[1]]$data

# another single file
pg_data(doi='10.1594/PANGAEA.807584')

# Many files
(res <- pg_data(doi='10.1594/PANGAEA.761032'))
res[[1]]
res[[2]]

# Manipulating the cache
## list files in the cache
pg_cache_list()

## clear all data
# pg_cache_clear()
pg_cache_list()

## clear a single dataset by DOI
pg_data(doi='10.1594/PANGAEA.812093')
pg_cache_list()
pg_cache_clear(doi='10.1594/PANGAEA.812093')
pg_cache_list()

## clear more than 1 dataset by DOI
lapply(c('10.1594/PANGAEA.746398','10.1594/PANGAEA.746400'), pg_data)
pg_cache_list()
pg_cache_clear(doi=c('10.1594/PANGAEA.746398','10.1594/PANGAEA.746400'))
pg_cache_list()

# search for datasets, then pass in DOIs
res <- pg_search(query='water', count=20)
pg_data(res$doi[1])
pg_data(res$doi[2])
pg_data(res$doi[3])
pg_data(res$doi[4])
pg_data(res$doi[5])

## End(Not run)