The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package {CepalStatR}


Title: Access to the 'CEPALSTAT API'
Version: 0.9.0
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.
License: MIT + file LICENSE
URL: https://github.com/Henry-Osorto/CepalStatR, https://henry-osorto.github.io/CepalStatR/
BugReports: https://github.com/Henry-Osorto/CepalStatR/issues
Encoding: UTF-8
Depends: R (≥ 4.1)
Imports: base64enc, dplyr, httr2, htmltools, jsonlite, magrittr, reactable, stringr, tidyselect, rlang, collapsibleTree, gridExtra, htmlwidgets
Suggests: ggplot2, gt, knitr, rmarkdown, svglite, testthat (≥ 3.0.0), vcr, webmockr
VignetteBuilder: knitr
Config/testthat/edition: 3
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2026-05-05 05:00:20 UTC; henry
Author: Henry Osorto ORCID iD [aut, cre]
Maintainer: Henry Osorto <henry.osorto@unah.edu.hn>
Repository: CRAN
Date/Publication: 2026-05-07 16:43:28 UTC

CepalStatR: 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.

Author(s)

Maintainer: Henry Osorto henry.osorto@unah.edu.hn (ORCID)

See Also

Useful links:


Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Arguments

lhs

A value or the magrittr placeholder.

rhs

A function call using the magrittr semantics.

Value

The result of calling rhs(lhs).


Call Data Indicators CEPALSTAT

Description

Retrieves indicator data from the CEPALSTAT API in JSON format and returns a data frame with values, dimensions, metadata, and optionally footnotes.

Usage

call.data(id.indicator, language.en = TRUE, notes = FALSE,
                 progress = TRUE, add.indicator.name = TRUE)

Arguments

id.indicator

A single CEPALSTAT indicator ID.

language.en

Logical. If TRUE (default), the output uses English labels. If FALSE, Spanish labels are used when applicable.

notes

Logical. If TRUE, footnotes are joined when available.

progress

Logical. If TRUE, progress messages are shown.

add.indicator.name

Logical. If TRUE, adds indicator ID and indicator name.

Value

A data frame with indicator values, dimension labels, and metadata.

Examples


data <- call.data(id.indicator = 4788)
data <- call.data(id.indicator = 4788, language.en = FALSE)
data <- call.data(id.indicator = 4788, notes = TRUE)


Call indicators from CEPALSTAT

Description

Retrieves the thematic tree from the CEPALSTAT API in JSON format and returns a data frame with the hierarchical structure of indicators.

Usage

call.indicators(language.en = TRUE, progress = TRUE)

Arguments

language.en

Logical. If TRUE (default), labels are returned in English. If FALSE, labels are returned in Spanish.

progress

Logical. If TRUE (default), progress messages are displayed.

Value

A data frame with the hierarchical thematic structure of CEPALSTAT indicators and the corresponding indicator ID.

Examples


data.indicators <- call.indicators()
data.indicators <- call.indicators(language.en = FALSE)


Internal helper to retrieve CEPALSTAT resources

Description

Internal helper to retrieve CEPALSTAT resources

Usage

cepal_get(url, format = c("json", "csv"), timeout_sec = 60)

List of countries available in CEPALSTAT

Description

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.

Usage

countries(language.en = TRUE)

Arguments

language.en

Logical. If TRUE (default), returns country names in English. If FALSE, returns names in Spanish.

Value

A data frame containing the list of countries.

Examples

countries()
countries(language.en = FALSE)

Convert an image file to a data URI

Description

Convert an image file to a data URI

Usage

img_to_data_uri(path)

Arguments

path

Path to the image file.

Value

A character string containing a data URI, or NULL if the file does not exist.


Population pyramids

Description

Creates one or multiple population pyramids for a selected country and years using CEPALSTAT population-by-age-and-sex data.

Usage

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
)

Arguments

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 TRUE (default), English labels are used. If FALSE, Spanish labels are used.

color

Character vector of length 2 with colors for men and women.

save

Logical. If TRUE, saves the resulting figure.

file

Character. Output filename when save = TRUE. If NULL, the file is saved to a temporary directory using tempdir().

format

Character. Output format when save = TRUE. One of "png" (default), "pdf" or "svg".

height

Numeric. Height of saved figure.

width

Numeric. Width of saved figure.

caption

Logical. If TRUE, adds a caption with source information.

progress

Logical. If TRUE, progress messages are shown.

Value

Invisibly returns a grob object created by gridExtra::arrangeGrob().

Examples


# 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"))


Sustainable Development Goals ranking

Description

Creates a ranking chart for a CEPALSTAT indicator belonging to the Sustainable Development Goals (SDG/ODS) dimension, using the latest available data by country.

Usage

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
)

Arguments

id.indicator

Numeric or character. Indicator ID.

language.en

Logical. If TRUE (default), English labels are used. If FALSE, Spanish labels are used.

save

Logical. If TRUE, saves the resulting figure.

file

Character. Output filename when save = TRUE. If NULL, the file is saved to a temporary directory using tempdir().

format

Character. Output format when save = TRUE. One of "png" (default), "pdf" or "svg".

height

Numeric. Height of saved figure.

width

Numeric. Width of saved figure.

size.title

Numeric. Title size.

title

Logical. If TRUE, displays the chart title.

caption

Logical. If TRUE, displays a note indicating the latest available year by country.

color

Character. Color for countries in the ranking.

color.gc

Character. Color for regional aggregates if present.

progress

Logical. If TRUE, shows progress messages during execution.

Value

Invisibly returns a ggplot object.

Examples


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"))


CEPALSTAT thematic map of indicators

Description

Creates an interactive thematic tree of CEPALSTAT indicators using collapsibleTree, with the same visual header and footer style as viewer.indicators().

Usage

topic_map(language.en = TRUE, progress = TRUE, open.browser = FALSE)

Arguments

language.en

Logical. If TRUE (default), English labels are used. If FALSE, Spanish labels are used.

progress

Logical. If TRUE, progress messages are shown.

open.browser

Logical. If TRUE, the generated HTML is saved to a temporary file and opened in the default web browser. Defaults to FALSE.

Value

A browsable HTML widget.

Examples


topic_map()

topic_map(language.en = FALSE)


Viewer for CEPALSTAT indicators

Description

Displays an interactive HTML table for browsing the hierarchical structure of CEPALSTAT indicators using call.indicators() as backend.

Usage

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
)

Arguments

language.en

Logical. If TRUE (default), the viewer uses English labels. If FALSE, Spanish labels are used.

progress

Logical. If TRUE, progress messages are shown.

show_search

Logical. If TRUE, enables global search in the table.

striped

Logical. If TRUE, striped rows are shown.

bordered

Logical. If TRUE, table borders are shown.

compact

Logical. If TRUE, reduces row padding.

highlight

Logical. If TRUE, highlights rows on hover.

full_width

Logical. If TRUE, table uses full available width.

page_size

Integer. Number of rows to show per page.

open.browser

Logical. If TRUE, the generated HTML is saved to a temporary file and opened in the default web browser. Defaults to FALSE.

Value

A browsable HTML object containing the header and interactive table.

Examples


viewer.indicators()
viewer.indicators(language.en = FALSE)
viewer.indicators(open.browser = TRUE)


CSS for viewer.indicators header layout

Description

CSS for viewer.indicators header layout

Usage

viewer_indicators_style()

Value

An htmltools style tag.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.