Commit 26b947e8 authored by Sébastien Galais's avatar Sébastien Galais
Browse files

Update README, vignette.

parent 2102b8cb
Pipeline #137728 passed with stage
in 9 minutes and 52 seconds
......@@ -4,9 +4,11 @@
providers (@fmgithub2017, #3 github).
* New function `rdb_dimensions()` to request the list of the dimensions of
the available datasets of the providers (@fmgithub2017, #3 github).
* New function `rdb_series()` to request the list of the series of
the available datasets of the providers (@fmgithub2017, #3 github).
* Add a clearer error message to the function to_xts() in README (Martin
Feldkircher, 20200326 email).
* Update vignette for `rdb_datasets()` and `rdb_dimensions()`.
* Update vignette for `rdb_datasets()`, `rdb_dimensions()` and `rdb_series()`.
# rdbnomics 0.5.2
......
......@@ -69,9 +69,9 @@ rdb_datasets <- function(
# }, simplify = FALSE)
# Additionals arguments
progress_bar = TRUE
progress_bar <- TRUE
if (length(list(...)) > 0) {
tmp_progress_bar = list(...)$progress_bar
tmp_progress_bar <- list(...)$progress_bar
if (!is.null(tmp_progress_bar)) {
progress_bar <- tmp_progress_bar
}
......
......@@ -71,9 +71,9 @@ rdb_dimensions <- function(
...
) {
# Additionals arguments
progress_bar = TRUE
progress_bar <- TRUE
if (length(list(...)) > 0) {
tmp_progress_bar = list(...)$progress_bar
tmp_progress_bar <- list(...)$progress_bar
if (!is.null(tmp_progress_bar)) {
progress_bar <- tmp_progress_bar
}
......
......@@ -75,24 +75,33 @@ rdb_series <- function(
...
) {
# Additionals arguments
progress_bar = TRUE
progress_bar <- TRUE
if (length(list(...)) > 0) {
tmp_progress_bar = list(...)$progress_bar
tmp_progress_bar <- list(...)$progress_bar
if (!is.null(tmp_progress_bar)) {
progress_bar <- tmp_progress_bar
}
}
check_argument(progress_bar, "logical")
only_first_two = FALSE
only_first_two <- FALSE
if (length(list(...)) > 0) {
tmp_only_first_two = list(...)$only_first_two
tmp_only_first_two <- list(...)$only_first_two
if (!is.null(tmp_only_first_two)) {
only_first_two <- tmp_only_first_two
}
}
check_argument(only_first_two, "logical")
only_number_series <- FALSE
if (length(list(...)) > 0) {
tmp_only_number_series <- list(...)$only_number_series
if (!is.null(tmp_only_number_series)) {
only_number_series <- tmp_only_number_series
}
}
check_argument(only_number_series, "logical")
# All providers
if (is.null(provider_code)) {
provider_code <- rdb_providers(
......@@ -146,6 +155,10 @@ rdb_series <- function(
limit <- DBlist$series$limit
num_found <- DBlist$series$num_found
if (only_number_series) {
return(data.table(Number_of_series = num_found))
}
if (verbose) {
if (getOption("rdbnomics.progress_bar_series") & progress_bar) {
cat("\n")
......
No preview for this file type
......@@ -134,6 +134,16 @@ provider, if you define `simplify = TRUE`, then the result will be a named list
df_dimensions <- rdb_dimensions(provider_code = "IMF", dataset_code = "WEO", simplify = TRUE)
```
## Fetch the number of series of available datasets of a provider
```r
# Example for the dataset WEOAGG of the IMF:
rdb_series(provider_code = "IMF", dataset_code = "WEOAGG", simplify = TRUE)
```
:warning: We ask the user to use this function parsimoniously because there are a huge amount
of series per dataset. Please only fetch for one dataset if you need it or
visit the website [https://db.nomics.world](https://db.nomics.world).
## Proxy configuration or connection error `Could not resolve host`
When using the function `rdb`, you may come across the following error:
```r
......
......@@ -688,7 +688,7 @@ You can measure the vast extent of datasets gathered by
[DBnomics](https://db.nomics.world) by downloading all the possible
dimensions. To do this, you have to set the arguments
`provider_code` and `dataset_code` to `NULL`.
Warning : it's relatively long to run and heavy to show so we display
<b><font color='red'>&#9888;</font></b> it's relatively long to run and heavy to show so we display
the first 100.
```{r, eval = FALSE}
options(rdbnomics.progress_bar_datasets = TRUE)
......@@ -726,6 +726,31 @@ rdbnomics:::rdbnomics_df022 %>%
# rbindlist(idcol = "Provider")
```
# Fetch the number of series of available datasets of a provider
You can download the list of series, and especially their codes, of a dataset's
provider by using the function `rdb_series`. The result is a nested named list
with a `data.table` at the end of each branch. If you define `simplify = TRUE`,
then the result will be a named list `data.table` not a nested named list.
For example, for the **IMF** provider and the dataset **WEO**, the command is:
```{r, eval = FALSE}
rdb_series(provider_code = "IMF", dataset_code = "WEO", simplify = TRUE)
```
```{r, eval = TRUE, echo = FALSE}
rdbnomics:::rdbnomics_df023 %>%
display_table()
```
<b><font color='red'>&#9888;</font></b> We ask the user to use this function parsimoniously because there are a huge amount
of series per dataset. Please only fetch for one dataset if you need it or
visit the website [https://db.nomics.world](https://db.nomics.world).
For example, for the **IMF** provider, the number of series is:
```{r, eval = TRUE, echo = FALSE}
rdbnomics:::rdbnomics_df024 %>%
.[order(-`Number of series`)] %>%
display_table()
```
# Proxy configuration or connection error `Could not resolve host`
When using the function `rdb`, you may come across the following error:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment