| Title: | Access to the 'CEPALSTAT API' |
|---|---|
| Description: | Explore metadata and retrieve indicators from the statistical portal of the Economic Commission for Latin America and the Caribbean <https://statistics.cepal.org/portal/cepalstat/>. Provides a reproducible interface to access the 'CEPALSTAT API', organize data into tidy formats, and generate both static and interactive visualizations. |
| Authors: | Henry Osorto [aut, cre] (ORCID: <https://orcid.org/0000-0002-4334-9179>) |
| Maintainer: | Henry Osorto <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.9.0 |
| Built: | 2026-06-06 05:54:13 UTC |
| Source: | https://github.com/cran/CepalStatR |
Retrieves indicator data from the CEPALSTAT API in JSON format and returns a data frame with values, dimensions, metadata, and optionally footnotes.
call.data(id.indicator, language.en = TRUE, notes = FALSE, progress = TRUE, add.indicator.name = TRUE)call.data(id.indicator, language.en = TRUE, notes = FALSE, progress = TRUE, add.indicator.name = TRUE)
id.indicator |
A single CEPALSTAT indicator ID. |
language.en |
Logical. If |
notes |
Logical. If |
progress |
Logical. If |
add.indicator.name |
Logical. If |
A data frame with indicator values, dimension labels, and metadata.
data <- call.data(id.indicator = 4788) data <- call.data(id.indicator = 4788, language.en = FALSE) data <- call.data(id.indicator = 4788, notes = TRUE)data <- call.data(id.indicator = 4788) data <- call.data(id.indicator = 4788, language.en = FALSE) data <- call.data(id.indicator = 4788, notes = TRUE)
Retrieves the thematic tree from the CEPALSTAT API in JSON format and returns a data frame with the hierarchical structure of indicators.
call.indicators(language.en = TRUE, progress = TRUE)call.indicators(language.en = TRUE, progress = TRUE)
language.en |
Logical. If |
progress |
Logical. If |
A data frame with the hierarchical thematic structure of CEPALSTAT indicators and the corresponding indicator ID.
data.indicators <- call.indicators() data.indicators <- call.indicators(language.en = FALSE)data.indicators <- call.indicators() data.indicators <- call.indicators(language.en = FALSE)
Retrieves the list of countries available in CEPALSTAT using the dimensions endpoint of a reference indicator. This approach avoids downloading full datasets and ensures consistency with the API structure.
countries(language.en = TRUE)countries(language.en = TRUE)
language.en |
Logical. If TRUE (default), returns country names in English. If FALSE, returns names in Spanish. |
A data frame containing the list of countries.
countries() countries(language.en = FALSE)countries() countries(language.en = FALSE)
Creates one or multiple population pyramids for a selected country and years using CEPALSTAT population-by-age-and-sex data.
pyramids( country, years = 1:31, language.en = TRUE, color = c("#0C4A61", "#34B0AA"), save = FALSE, file = NULL, format = c("png", "pdf", "svg"), height = 5, width = 7, caption = TRUE, progress = TRUE )pyramids( country, years = 1:31, language.en = TRUE, color = c("#0C4A61", "#34B0AA"), save = FALSE, file = NULL, format = c("png", "pdf", "svg"), height = 5, width = 7, caption = TRUE, progress = TRUE )
country |
Character. Name of the country or region to plot. |
years |
Numeric vector of positions between 1 and 31 corresponding to 5-year intervals from 1950 to 2100. |
language.en |
Logical. If |
color |
Character vector of length 2 with colors for men and women. |
save |
Logical. If |
file |
Character. Output filename when |
format |
Character. Output format when |
height |
Numeric. Height of saved figure. |
width |
Numeric. Width of saved figure. |
caption |
Logical. If |
progress |
Logical. If |
Invisibly returns a grob object created by gridExtra::arrangeGrob().
# Single year pyramids(country = "Honduras", years = 16) # Multiple years pyramids(country = "Honduras", years = c(1, 5, 10, 15)) #' # Save as PNG pyramids(country = "Honduras", years = c(1, 5, 10, 15), save = TRUE, file = file.path(tempdir(), "pyramids.png")) # Save as PDF pyramids(country = "Honduras", years = c(1, 5, 10, 15), save = TRUE, format = "pdf", file = file.path(tempdir(), "pyramids.pdf")) # Save as SVG pyramids(country = "Honduras", years = c(1, 5, 10, 15), save = TRUE, format = "svg", file = file.path(tempdir(), "pyramids.svg"))# Single year pyramids(country = "Honduras", years = 16) # Multiple years pyramids(country = "Honduras", years = c(1, 5, 10, 15)) #' # Save as PNG pyramids(country = "Honduras", years = c(1, 5, 10, 15), save = TRUE, file = file.path(tempdir(), "pyramids.png")) # Save as PDF pyramids(country = "Honduras", years = c(1, 5, 10, 15), save = TRUE, format = "pdf", file = file.path(tempdir(), "pyramids.pdf")) # Save as SVG pyramids(country = "Honduras", years = c(1, 5, 10, 15), save = TRUE, format = "svg", file = file.path(tempdir(), "pyramids.svg"))
Creates a ranking chart for a CEPALSTAT indicator belonging to the Sustainable Development Goals (SDG/ODS) dimension, using the latest available data by country.
ranking.sdg( id.indicator, language.en = TRUE, save = FALSE, file = NULL, format = c("png", "pdf", "svg"), height = 5, width = 9, size.title = 10, title = TRUE, caption = TRUE, color = "#0C4A61", color.gc = "#34B0AA", progress = TRUE )ranking.sdg( id.indicator, language.en = TRUE, save = FALSE, file = NULL, format = c("png", "pdf", "svg"), height = 5, width = 9, size.title = 10, title = TRUE, caption = TRUE, color = "#0C4A61", color.gc = "#34B0AA", progress = TRUE )
id.indicator |
Numeric or character. Indicator ID. |
language.en |
Logical. If |
save |
Logical. If |
file |
Character. Output filename when |
format |
Character. Output format when |
height |
Numeric. Height of saved figure. |
width |
Numeric. Width of saved figure. |
size.title |
Numeric. Title size. |
title |
Logical. If |
caption |
Logical. If |
color |
Character. Color for countries in the ranking. |
color.gc |
Character. Color for regional aggregates if present. |
progress |
Logical. If |
Invisibly returns a ggplot object.
ranking.sdg(id.indicator = 3682) ranking.sdg(id.indicator = 3682, language.en = FALSE) ranking.sdg(id.indicator = 3682, save = TRUE, file = file.path(tempdir(), "ranking_sdg.png")) ranking.sdg(id.indicator = 3682, save = TRUE, format = "pdf", file = file.path(tempdir(), "ranking_sdg.pdf")) ranking.sdg(id.indicator = 3682, save = TRUE, format = "svg", file = file.path(tempdir(), "ranking_sdg.svg"))ranking.sdg(id.indicator = 3682) ranking.sdg(id.indicator = 3682, language.en = FALSE) ranking.sdg(id.indicator = 3682, save = TRUE, file = file.path(tempdir(), "ranking_sdg.png")) ranking.sdg(id.indicator = 3682, save = TRUE, format = "pdf", file = file.path(tempdir(), "ranking_sdg.pdf")) ranking.sdg(id.indicator = 3682, save = TRUE, format = "svg", file = file.path(tempdir(), "ranking_sdg.svg"))
Creates an interactive thematic tree of CEPALSTAT indicators using
collapsibleTree, with the same visual header and footer style as
viewer.indicators().
topic_map(language.en = TRUE, progress = TRUE, open.browser = FALSE)topic_map(language.en = TRUE, progress = TRUE, open.browser = FALSE)
language.en |
Logical. If |
progress |
Logical. If |
open.browser |
Logical. If |
A browsable HTML widget.
topic_map() topic_map(language.en = FALSE)topic_map() topic_map(language.en = FALSE)
Displays an interactive HTML table for browsing the hierarchical structure
of CEPALSTAT indicators using call.indicators() as backend.
viewer.indicators( language.en = TRUE, progress = TRUE, show_search = TRUE, striped = TRUE, bordered = FALSE, compact = FALSE, highlight = TRUE, full_width = TRUE, page_size = 15, open.browser = FALSE )viewer.indicators( language.en = TRUE, progress = TRUE, show_search = TRUE, striped = TRUE, bordered = FALSE, compact = FALSE, highlight = TRUE, full_width = TRUE, page_size = 15, open.browser = FALSE )
language.en |
Logical. If |
progress |
Logical. If |
show_search |
Logical. If |
striped |
Logical. If |
bordered |
Logical. If |
compact |
Logical. If |
highlight |
Logical. If |
full_width |
Logical. If |
page_size |
Integer. Number of rows to show per page. |
open.browser |
Logical. If |
A browsable HTML object containing the header and interactive table.
viewer.indicators() viewer.indicators(language.en = FALSE) viewer.indicators(open.browser = TRUE)viewer.indicators() viewer.indicators(language.en = FALSE) viewer.indicators(open.browser = TRUE)