bef.portal.get.dataset: Fetch primary data from a BEFdata portal dataset.

Description Usage Arguments Details Value Examples

Description

This function fetches data associated with a BEFdata portal dataset. By default it will fetch the CSV file of a dataset. You need to provide the function with a dataset id which you can find in the URL of the dataset on the BEFdata portal. As this usually requires authentication you need to set your credentials in the options (bef.options("user_credentials" = "asdfpoj"). You can find the credentials inside of your profile page on the BEFdata portal. The credentials ensure you have the rights to download the data.

Usage

1
  bef.portal.get.dataset(id, curl = getCurlHandle(), ...)

Arguments

id

This is the ID of a dataset on a BEFdata portal.

curl

If the function is used inside a loop, call getCurlHandle() first and pass in the returned value here. This avoids an unnecessary footprint.

...

Arguments passed to getURLContent

Details

The function returns a dataset object which you can store in a variable as shown in the examples below. The object also offers additional information by attributes. You can query the information via the attributes() function which is also shown in the examples. If you like to fetch multiple datasets you can use the apply functions provided by R see example below.

Value

The function returns a data frame of the dataset. An error is thrown when the dataset is not found or if you don't have the rights to access it.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
        datset1 = bef.portal.get.dataset(id=8)
        metadata1 = attributes(dataset1)

        curl = getCurlHandle()
        ids = c(8,70)
        dataset_list = lapply(ids, function(x) bef.portal.get.dataset_by(id = x, curl = curl))
        metadata = attributes(dataset_list[[1]])
      
## End(Not run)

rbefdata documentation built on May 2, 2019, 8:39 a.m.