View source: R/read_database.R
read_database | R Documentation |
Returns the data sets for the given reference - agencyid:id(version), as a list, or as a tidy data.table. A collection of data sets in econdatar is referred to as a database. Tidying can be done directly within read_database()
, or ex-post using tidy_data()
.
read_database(id, include_series = FALSE, tidy = FALSE, ...)
## S3 method for class 'eds_database'
tidy_data(x, ...)
id |
Data set identifier. May be |
include_series |
If |
x |
A raw API return object to be tidied. Can also be done directly in |
.
... |
Further Optional arguments:
| |||||||
tidy |
logical. Return data and metadata in tidy data.table's (see Value), by passing the result through |
An EconData account (http://econdata.co.za) is required to use this function. The user must provide an API token that can be found on the Account page of the online portal, a GUI dialog will prompt the user for their API token. Credentials can also be supplied by setting the ECONDATA_CREDENTIALS environment variable using the syntax: "client_id;client_secret", e.g. Sys.setenv(ECONDATA_CREDENTIALS="client_id;client_secret")
, when available.
If tidy = FALSE
, an unnamed list of data frames is returned. Each data frame further has a "metadata"
attribute providing information about the data set.
If tidy = TRUE
a single data.table is returned with columns for "agencyid"
, "id"
, "version"
, "name"
, and "description"
.
write_database
## Not run:
# library(econdatar)
# Mining production and sales
MINING <- read_database(id = "MINING")
# Include previous versions
MINING <- read_database(id = "MINING", versions = "all")
# Return series without obervations (empty data set)
MINING <- read_database(id = "MINING", include_series = TRUE)
# Return all data sets (useful for browsing available data)
CATALOGUE <- read_database(id = "all")
tidy_data(CATALOGUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.