| Type: | Package | 
| Title: | Access Chilean Data via APIs and Curated Datasets | 
| Version: | 0.2.0 | 
| Maintainer: | Renzo Caceres Rossi <arenzocaceresrossi@gmail.com> | 
| Description: | Provides functions to access data from public RESTful APIs including 'FINDIC API', 'REST Countries API', 'World Bank API', and 'Nager.Date', retrieving real-time or historical data related to Chile such as financial indicators, holidays, international demographic and geopolitical indicators, and more. Additionally, the package includes curated datasets related to Chile, covering topics such as human rights violations during the Pinochet regime, electoral data, census samples, health surveys, seismic events, territorial codes, and environmental measurements. The package supports research and analysis focused on Chile by integrating open APIs with high-quality datasets from multiple domains. For more information on the APIs, see: 'FINDIC' https://findic.cl/, 'REST Countries' https://restcountries.com/, 'World Bank API' https://datahelpdesk.worldbank.org/knowledgebase/articles/889392, and 'Nager.Date' https://date.nager.at/Api. | 
| License: | GPL-3 | 
| Language: | en | 
| URL: | https://github.com/lightbluetitan/chiledataapi, https://lightbluetitan.github.io/chiledataapi/ | 
| BugReports: | https://github.com/lightbluetitan/chiledataapi/issues | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| Depends: | R (≥ 4.1.0) | 
| Imports: | utils, httr, jsonlite, dplyr, tibble, scales | 
| Suggests: | ggplot2, testthat (≥ 3.0.0), knitr, rmarkdown | 
| RoxygenNote: | 7.3.2 | 
| Config/testthat/edition: | 3 | 
| VignetteBuilder: | knitr | 
| NeedsCompilation: | no | 
| Packaged: | 2025-09-11 06:45:37 UTC; Renzo | 
| Author: | Renzo Caceres Rossi | 
| Repository: | CRAN | 
| Date/Publication: | 2025-09-11 08:00:13 UTC | 
ChileDataAPI: Access Chilean Data via APIs and Curated Datasets
Description
This package provides functions to access data from public RESTful APIs including 'FINDIC API', 'REST Countries API', 'World Bank API', and 'Nager.Date', retrieving real-time or historical data related to Chile such as financial indicators, holidays, international demographic and geopolitical indicators, and more. Additionally, the package includes curated datasets related to Chile, covering topics such as human rights violations during the Pinochet regime, electoral data, census samples, health surveys, seismic events, territorial codes, and environmental measurements..
Details
ChileDataAPI: Access Chilean Data via APIs and Curated Datasets
 
Access Chilean Data via APIs and Curated Datasets.
Author(s)
Maintainer: Renzo Caceres Rossi arenzocaceresrossi@gmail.com
See Also
Useful links:
Chilean Census Example Data (San Pablo Commune, 2017)
Description
This dataset, census_chile_2017_df, is a data frame containing microdata from the 2017 Chilean census, specifically from the commune of San Pablo. It was selected due to its relatively small size, making it suitable for inclusion in CRAN and GitHub repositories. The dataset includes 7,512 observations and 60 variables related to housing, households, individuals, migration, education, and geographic information. All variable names and data values are in Spanish, as retrieved from the original source.
Usage
data(census_chile_2017_df)
Format
A data frame with 7,512 observations and 60 variables:
- region
- Administrative region code 
- provincia
- Province code 
- comuna
- Commune code 
- dc
- Census district code 
- area
- Urban/rural area indicator 
- zc_loc
- Census location zone 
- id_zona_loc
- Location zone ID 
- nviv
- Number of dwellings 
- nhogar
- Number of households 
- personan
- Person number 
- p07
- Sex 
- p08
- Relationship to head of household 
- p09
- Age 
- p10
- Place of birth (Chile or abroad) 
- p10comuna
- Commune of birth 
- p10pais
- Country of birth 
- p11
- Last place of residence 
- p11comuna
- Commune of last residence 
- p11pais
- Country of last residence 
- p12
- Place of residence in 2012 
- p12comuna
- Commune of residence in 2012 
- p12pais
- Country of residence in 2012 
- p12a_llegada
- Year of arrival 
- p12a_tramo
- Time range of arrival 
- p13
- Health insurance 
- p14
- Marital status 
- p15
- Educational level 
- p15a
- Currently attending school 
- p16
- Employment status 
- p16a
- Occupation type 
- p16a_otro
- Other occupation (free text) 
- p17
- Disability indicator 
- p18
- Ethnic group 
- p19
- Language spoken 
- p20
- Language understood 
- p21m
- Month of migration 
- p21a
- Year of migration 
- p10pais_grupo
- Grouped birth country 
- p11pais_grupo
- Grouped last residence country 
- p12pais_grupo
- Grouped 2012 residence country 
- escolaridad
- Years of schooling 
- p16a_grupo
- Grouped occupation 
- region_15r
- Region code (15-region system) 
- provincia_15r
- Province code (15-region system) 
- comuna_15r
- Commune code (15-region system) 
- p10comuna_15r
- Commune of birth (15-region system) 
- p11comuna_15r
- Commune of last residence (15-region system) 
- p12comuna_15r
- Commune of residence in 2012 (15-region system) 
- geocode
- Geographical identifier 
- p01
- Type of dwelling 
- p02
- Dwelling condition 
- p03a
- Material of exterior walls 
- p03b
- Material of floor 
- p03c
- Material of roof 
- p04
- Number of rooms 
- p05
- Number of bedrooms 
- cant_hog
- Number of households in the dwelling 
- cant_per
- Number of persons in the dwelling 
- tipo_hogar
- Type of household 
- tipo_operativo
- Census operation type 
Details
The dataset name has been kept as census_chile_2017_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix df indicates that the dataset is a data frame. The original content has not been modified.
Source
Data taken from the ismtchile package version 2.1.5.
Chilean Earthquakes Data
Description
This dataset, chile_earthquakes_tbl_df, is a tibble containing information about significant (perceptible) earthquakes that occurred in Chile from January 1st, 2012 to the present. The data was originally compiled by the Centro Sismológico Nacional (Chile) and was published on Kaggle by Nicolás González Muñoz. The dataset includes 4,018 observations and 5 variables, capturing relevant geophysical characteristics such as the date and time of occurrence, geographic coordinates, depth, and magnitude of each seismic event.
Usage
data(chile_earthquakes_tbl_df)
Format
A tibble with 4,018 observations and 5 variables:
- Date(UTC)
- Timestamp of the earthquake in UTC (POSIXct) 
- Latitude
- Latitude coordinate of the event (numeric) 
- Longitude
- Longitude coordinate of the event (numeric) 
- Depth
- Depth in kilometers (numeric) 
- Magnitude
- Richter magnitude of the earthquake (numeric) 
Details
The dataset name has been kept as 'chile_earthquakes_tbl_df' to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix 'tbl_df' indicates that the dataset is a tibble (a modern data frame). The original content has not been modified in any way. Variable names and values are in English, as originally provided by the source.
Source
Data taken from Kaggle: https://www.kaggle.com/datasets/nicolasgonzalezmunoz/earthquakes-on-chile
Chilean 2021 First Round Presidential Election
Description
This dataset, chile_election_2021_df, is a data frame containing the results of the first round of the 2021 Chilean presidential elections. It includes vote counts for seven presidential candidates, as well as counts for blank and null votes. Each observation corresponds to an individual ballot box, identified by its unique ID and associated electoral district. Additionally, the dataset includes demographic information on the age distribution of voters for each ballot box, and a logical indicator for mismatches or inconsistencies in the vote counts.
Usage
data(chile_election_2021_df)
Format
A data frame with 46,606 observations and 21 variables:
- REGION
- Administrative region (character) 
- ELECTORAL.DISTRICT
- Electoral district (character) 
- BALLOT.BOX
- Unique identifier for the ballot box (character) 
- C1
- Votes for Candidate 1 (integer) 
- C2
- Votes for Candidate 2 (integer) 
- C3
- Votes for Candidate 3 (integer) 
- C4
- Votes for Candidate 4 (integer) 
- C5
- Votes for Candidate 5 (integer) 
- C6
- Votes for Candidate 6 (integer) 
- C7
- Votes for Candidate 7 (integer) 
- BLANK.VOTES
- Count of blank votes (integer) 
- NULL.VOTES
- Count of null votes (integer) 
- X18.19
- Voters aged 18–19 (integer) 
- X20.29
- Voters aged 20–29 (integer) 
- X30.39
- Voters aged 30–39 (integer) 
- X40.49
- Voters aged 40–49 (integer) 
- X50.59
- Voters aged 50–59 (integer) 
- X60.69
- Voters aged 60–69 (integer) 
- X70.79
- Voters aged 70–79 (integer) 
- X80.
- Voters aged 80 and older (integer) 
- MISMATCH
- Logical indicator of inconsistency in vote reporting (logical) 
Details
The dataset name has been kept as chile_election_2021_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix df indicates that the dataset is a data frame. The original content has not been modified.
Source
Data taken from the fastei package version 0.0.0.7.
Chilean National Health Survey (2016–2017)
Description
This dataset, chile_health_survey_df, is a data frame containing information collected by the Chilean National Health Survey conducted between 2016 and 2017. The objective of the survey was to study the health status of the Chilean population and support health-related public policy design. The dataset includes biometric, behavioral, demographic, and educational variables from 3,211 individuals.
Usage
data(chile_health_survey_df)
Format
A data frame with 3,211 observations and 12 variables:
- pas, pad
- Systolic and diastolic blood pressure (numeric) 
- age
- Age of the respondent (integer) 
- waist, bmi
- Waist circumference and body mass index (numeric) 
- sedentary, smoker, diabetes, depression
- Health behavior and condition indicators (integer) 
- male
- Sex of the respondent (1 = male, 0 = female) (integer) 
- scholar2, scholar3
- Education level indicators (integer) 
Details
The dataset name has been kept as 'chile_health_survey_df' to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix 'df' indicates that the dataset is a data frame. The original content has not been modified in any way.
Source
Data taken from the abms package version 0.2
Voting Intentions in the 1988 Chilean Plebiscite
Description
This dataset, chile_plebiscite_df, is a data frame containing information on voting intentions in the 1988 Chilean plebiscite. The data were collected from a national survey conducted by FLACSO/Chile during April and May of 1988. The dataset consists of 2,700 observations and 8 variables, including demographic details such as region, sex, age, education, and income, as well as voting preferences and support for the status quo. Some observations contain missing values.
Usage
data(chile_plebiscite_df)
Format
A data frame with 2,700 observations and 8 variables:
- region
- Region of the respondent (factor with 5 levels: "C", "M", "N", "S", ...) 
- population
- Population size of the respondent's area (integer) 
- sex
- Sex of the respondent (factor: "F", "M") 
- age
- Age in years (integer) 
- education
- Education level (factor with 3 levels: "P", "PS", "S") 
- income
- Income of the respondent (integer) 
- statusquo
- Support for the status quo (numeric scale) 
- vote
- Intended vote (factor with 4 levels) 
Details
The dataset name has been kept as 'chile_plebiscite_df' to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix 'df' indicates that the dataset is a data frame. The original content has not been modified in any way.
Source
Data taken from the carData package version 3.0-5
Get Observed Bitcoin Value from the findic.cl API
Description
This function retrieves the observed value of Bitcoin in US Dollars from the API endpoint: https://findic.cl/api/bitcoin. The data is provided by the Chilean website findic.cl.
Usage
get_chile_bitcoin()
Details
The values returned by the API include metadata and a time series of daily values.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/bitcoin endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha del valor observado (en formato "YYYY-MM-DD").
-  valor: Valor del bitcoin en dólares estadounidenses (numérico).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
bitcoin_data <- get_chile_bitcoin()
head(bitcoin_data)
## End(Not run)
Get Chile's Under-5 Mortality Rate from World Bank
Description
Retrieves Chile's under-5 mortality rate, measured as the number of deaths
of children under five years of age per 1,000 live births, for the years 2010 to 2022
using the World Bank Open Data API. The indicator used is SH.DYN.MORT.
Usage
get_chile_child_mortality()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "Mortality rate, under-5 (per 1,000 live births)")
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Mortality rate (per 1,000 live births)
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/SH.DYN.MORT
See Also
Examples
if (interactive()) {
  get_chile_child_mortality()
}
Get Observed Copper Price per Pound from the findic.cl API
Description
This function retrieves the observed daily value of the copper price per pound ("Libra de Cobre") in U.S. Dollars from the API endpoint: https://findic.cl/api/libra_cobre. The data is provided by the Chilean website findic.cl.
Usage
get_chile_copper_pound()
Details
The values returned by the API include metadata and a time series of daily prices.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/libra_cobre endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha del valor observado (in format "YYYY-MM-DD").
-  valor: Valor de la libra de cobre en dólares estadounidenses (numeric).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
copper_data <- get_chile_copper_pound()
head(copper_data)
## End(Not run)
Get Chile's Consumer Price Index (2010 = 100) from World Bank
Description
Retrieves Chile's Consumer Price Index (CPI), with 2010 as the base year (index = 100),
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is FP.CPI.TOTL.
Usage
get_chile_cpi()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "Consumer price index (2010 = 100)")
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Consumer Price Index (numeric, base year 2010 = 100)
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/FP.CPI.TOTL
See Also
Examples
if (interactive()) {
  get_chile_cpi()
}
Get Observed Dollar Exchange Rate from the findic.cl API
Description
This function retrieves the observed exchange rate ("Dólar observado") in Chilean Pesos from the API endpoint: https://findic.cl/api/dolar. The data is provided by the Chilean website findic.cl.
Usage
get_chile_dollar()
Details
The values returned by the API include metadata and a time series of daily exchange rates.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/dolar endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha del valor observado (en formato "YYYY-MM-DD").
-  valor: Valor del dólar observado en pesos chilenos (numérico).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
dolar_data <- get_chile_dollar()
head(dolar_data)
## End(Not run)
Get Chile's Energy Use (kg of oil equivalent per capita) from World Bank
Description
Retrieves Chile's energy use per capita, measured in kilograms of oil equivalent,
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is EG.USE.PCAP.KG.OE.
Usage
get_chile_energy_use()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "Energy use (kg of oil equivalent per capita)")
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Energy use in kilograms of oil equivalent per capita
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/EG.USE.PCAP.KG.OE
See Also
Examples
if (interactive()) {
  get_chile_energy_use()
}
Get Observed Euro Exchange Rate from the findic.cl API
Description
This function retrieves the observed exchange rate ("Euro (pesos por euro)") in Chilean Pesos from the API endpoint: https://findic.cl/api/euro. The data is provided by the Chilean website findic.cl.
Usage
get_chile_euro()
Details
The values returned by the API include metadata and a time series of daily exchange rates.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/euro endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha del valor observado (en formato "YYYY-MM-DD").
-  valor: Valor del euro observado en pesos chilenos (numérico).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
euro_data <- get_chile_euro()
head(euro_data)
## End(Not run)
Get Chile's GDP (current US$) from World Bank
Description
Retrieves Chile's Gross Domestic Product (GDP) in current US dollars
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is NY.GDP.MKTP.CD.
Usage
get_chile_gdp()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "GDP (current US$)")
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: GDP in current US dollars
-  value_label: Formatted GDP with commas (e.g., "1,800,000,000,000")
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/NY.GDP.MKTP.CD
See Also
GET, fromJSON, as_tibble, comma
Examples
if (interactive()) {
  get_chile_gdp()
}
Get Official Public Holidays in Chile for a Given Year
Description
Retrieves the list of official public holidays in Chile for a specific year using the Nager.Date public holidays API. This function returns a tibble containing the date of the holiday, the name in the local language (Spanish), and the English name. It is useful for academic, planning, and data analysis purposes. The information is retrieved directly from the Nager.Date API and reflects the current status of holidays for the requested year. The field names returned are consistent with the API structure.
Usage
get_chile_holidays(year)
Arguments
| year | An integer indicating the year (e.g., 2024 or 2025). | 
Value
A tibble with the following columns:
-  date: Date of the holiday (classDate)
-  local_name: Holiday name in the local language (Spanish)
-  name: Holiday name in English
Source
Data obtained from the Nager.Date API: https://date.nager.at/
Examples
get_chile_holidays(2024)
get_chile_holidays(2025)
Get Chile's Hospital Beds (per 1,000 people) from World Bank
Description
Retrieves Chile's number of hospital beds per 1,000 people
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is SH.MED.BEDS.ZS.
Usage
get_chile_hospital_beds()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "Hospital beds (per 1,000 people)")
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Number of hospital beds per 1,000 people
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/SH.MED.BEDS.ZS
See Also
Examples
if (interactive()) {
  get_chile_hospital_beds()
}
Get IPSA (Índice de Precios Selectivo de Acciones) from the findic.cl API
Description
This function retrieves the historical values of the IPSA index ("Índice de Precios Selectivo de Acciones") from the API endpoint: https://findic.cl/api/ipsa. The data is provided by the Chilean website findic.cl.
Usage
get_chile_ipsa()
Details
The values returned by the API include metadata and a time series of daily IPSA index values.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/ipsa endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha de la observación (in "YYYY-MM-DD" format).
-  valor: Valor del índice IPSA en puntos (numeric).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
ipsa_data <- get_chile_ipsa()
head(ipsa_data)
## End(Not run)
Get Chile's Life Expectancy at Birth (Total, Years) from World Bank
Description
Retrieves Chile's life expectancy at birth (total, years)
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is SP.DYN.LE00.IN.
Usage
get_chile_life_expectancy()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "Life expectancy at birth, total (years)")
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Life expectancy at birth in years
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/SP.DYN.LE00.IN
See Also
Examples
if (interactive()) {
  get_chile_life_expectancy()
}
Get Chile's Adult Literacy Rate
Description
Retrieves Chile's adult literacy rate (
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is SE.ADT.LITR.ZS.
Usage
get_chile_literacy_rate()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Literacy rate as a percentage
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/SE.ADT.LITR.ZS
See Also
Examples
  literacy_data <- get_chile_literacy_rate()
  head(literacy_data)
Get Chile's Total Population from World Bank
Description
Retrieves Chile's total population for the years 2010 to 2022
using the World Bank Open Data API. The indicator used is SP.POP.TOTL.
Usage
get_chile_population()
Details
The function sends a GET request to the World Bank API.
If the API request fails or returns an error status code, the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "Population, total")
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Population as a numeric value
-  value_label: Formatted population with commas (e.g., "51,000,000")
Note
Requires internet connection. The data is retrieved in real time from the World Bank API.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/SP.POP.TOTL
See Also
GET, fromJSON, as_tibble, comma
Examples
if (interactive()) {
  get_chile_population()
}
Get Unidad de Fomento (UF) from the findic.cl API
Description
This function retrieves the Unidad de Fomento (UF) daily values in Chilean Pesos from the API endpoint: https://findic.cl/api/uf. The data is provided by the Chilean website findic.cl.
Usage
get_chile_uf()
Details
The values returned by the API include metadata and a time series of daily UF values.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/uf endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha del valor observado (in "YYYY-MM-DD" format).
-  valor: Valor diario de la UF en pesos chilenos (numeric).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
uf_data <- get_chile_uf()
head(uf_data)
## End(Not run)
Get Chile's Unemployment Rate (Total) from World Bank
Description
Retrieves Chile's total unemployment rate, measured as a percentage of the total labor force,
for the years 2010 to 2022 using the World Bank Open Data API.
The indicator used is SL.UEM.TOTL.ZS.
Usage
get_chile_unemployment()
Details
This function sends a GET request to the World Bank API.
If the API request fails or returns an error status code,
the function returns NULL with an informative message.
Value
A tibble with the following columns:
-  indicator: Indicator name (e.g., "Unemployment, total (
-  country: Country name ("Chile")
-  year: Year of the data (integer)
-  value: Unemployment rate as a numeric value (percentage)
Note
Requires internet connection.
Source
World Bank Open Data API: https://data.worldbank.org/indicator/SL.UEM.TOTL.ZS
See Also
Examples
if (interactive()) {
  get_chile_unemployment()
}
Get Monthly Tax Unit (UTM) from the findic.cl API
Description
This function retrieves the historical values of the Unidad Tributaria Mensual (UTM) in Chilean Pesos from the API endpoint: https://findic.cl/api/utm. The data is provided by the Chilean website findic.cl.
Usage
get_chile_utm()
Details
The values returned by the API include metadata and a time series of monthly values.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/utm endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha de referencia del valor mensual (in format "YYYY-MM-DD").
-  valor: Valor mensual de la Unidad Tributaria Mensual (UTM) en pesos chilenos (numeric).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
utm_data <- get_chile_utm()
head(utm_data)
## End(Not run)
Get Observed Yen Exchange Rate from the findic.cl API
Description
This function retrieves the observed exchange rate ("Yen (pesos por yen)") in Chilean Pesos from the API endpoint: https://findic.cl/api/yen. The data is provided by the Chilean website findic.cl.
Usage
get_chile_yen()
Details
The values returned by the API include metadata and a time series of daily exchange rates.
The names of the variables and the values are in Spanish, exactly as provided by the API.
For example, the result includes columns named fecha (date) and valor (value).
The function sends a GET request to the /api/yen endpoint. If the request is successful (HTTP 200),
it parses the JSON response and extracts the time series data under the key serie.
All names and values are kept in Spanish as provided by the API and no translation or modification is applied.
Value
A tibble (data frame) with the following columns:
-  fecha: Fecha del valor observado (en formato "YYYY-MM-DD").
-  valor: Valor del yen observado en pesos chilenos (numérico).
Note
Requires internet connection. The function returns the values exactly as provided in Spanish.
See Also
Examples
## Not run: 
yen_data <- get_chile_yen()
head(yen_data)
## End(Not run)
Get Country Information for Chile
Description
Retrieves comprehensive country information for Chile from the REST Countries API. This function fetches data including official and common names, geographical information, capital, area, population, and languages.
Usage
get_country_info_cl()
Details
This function makes a request to the REST Countries API v3.1 endpoint specifically for Chile using full text search. It handles API errors gracefully and returns NULL if the request fails or no data is found.
Value
A tibble with one row containing Chile's country information:
- name_common
- Common name of the country 
- name_official
- Official name of the country 
- region
- Geographic region 
- subregion
- Geographic subregion 
- capital
- Capital city(ies) 
- area
- Total area in square kilometers 
- population
- Total population 
- languages
- Languages spoken (comma-separated) 
Examples
# Get Chile information
cl_info <- get_country_info_cl()
print(cl_info)
Average Araucaria Araucana Tree Ring Width
Description
This dataset, malleco_tree_rings_ts, is a time series object ('ts') containing the average annual tree ring width, measured in millimeters, for Araucaria Araucana trees located in the Malleco region of Chile. The data spans 734 years, from 1242 to 1975, and was originally collected for use in climate and environmental reconstructions. The frequency of the series is annual (one observation per year). The series shows interannual variability in growth and is suitable for time series analysis and dendrochronological studies.
Usage
data(malleco_tree_rings_ts)
Format
A time series object with 734 annual observations:
- Start year
- 1242 
- End year
- 1975 
- Frequency
- Annual (1) 
- Values
- Average annual ring width in millimeters (numeric) 
Details
The dataset name has been kept as 'malleco_tree_rings_ts' to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix 'ts' indicates that the dataset is a time series object. The original content has not been modified in any way.
Source
Data taken from the LSTS package version 2.1
Human Rights Abuses in the Pinochet Regime (1973–1990)
Description
This dataset, pinochet_regime_df, is a data frame containing detailed information about human rights violations that occurred in Chile during the military dictatorship of Augusto Pinochet, spanning from 1973 to 1990. The data includes victim-level records such as names, age, gender, affiliation, nature of the violence, methods used, and geographic information when available. It is based on the National Truth and Reconciliation Commission Report (1991, ISBN:9780268016463). The dataset also includes georeferenced locations across multiple levels for incidents where such data could be retrieved.
Usage
data(pinochet_regime_df)
Format
A data frame with 2,398 observations and 59 variables:
- individual_id
- Victim ID 
- group_id
- Group ID for collective incidents 
- start_date_daily
- Start date (day precision) 
- end_date_daily
- End date (day precision) 
- start_date_monthly
- Start date (month precision) 
- end_date_monthly
- End date (month precision) 
- last_name
- Victim's last name 
- first_name
- Victim's first name 
- minor
- Indicator if victim was a minor 
- age
- Age of the victim 
- male
- Indicator if victim was male 
- occupation
- Victim's occupation 
- occupation_detail
- Detailed occupation description 
- victim_affiliation
- Affiliation of the victim 
- victim_affiliation_detail
- Detailed affiliation 
- violence
- Type of violence experienced 
- method
- Method of violence 
- interrogation
- Interrogation indicator 
- torture
- Torture indicator 
- mistreatment
- Mistreatment indicator 
- targeted
- Targeting category 
- press
- Indicator for press involvement 
- war_tribunal
- War tribunal indicator 
- number_previous_arrests
- Number of previous arrests 
- perpetrator_affiliation
- Affiliation of perpetrator 
- perpetrator_affiliation_detail
- Detailed affiliation of perpetrator 
- nationality
- Victim's nationality 
- place_1
- First incident location 
- location_1
- First location detail 
- latitude_1
- Latitude of first location 
- longitude_1
- Longitude of first location 
- exact_coordinates_1
- Indicator of coordinate precision (1 = exact) 
- place_2
- Second incident location 
- location_2
- Second location detail 
- latitude_2
- Latitude of second location 
- longitude_2
- Longitude of second location 
- exact_coordinates_2
- Indicator of coordinate precision (2nd) 
- place_3
- Third incident location 
- location_3
- Third location detail 
- latitude_3
- Latitude of third location 
- longitude_3
- Longitude of third location 
- exact_coordinates_3
- Indicator of coordinate precision (3rd) 
- place_4
- Fourth incident location 
- location_4
- Fourth location detail 
- latitude_4
- Latitude of fourth location 
- longitude_4
- Longitude of fourth location 
- exact_coordinates_4
- Indicator of coordinate precision (4th) 
- place_5
- Fifth incident location 
- location_5
- Fifth location detail 
- latitude_5
- Latitude of fifth location 
- longitude_5
- Longitude of fifth location 
- exact_coordinates_5
- Indicator of coordinate precision (5th) 
- place_6
- Sixth incident location 
- location_6
- Sixth location detail 
- latitude_6
- Latitude of sixth location 
- longitude_6
- Longitude of sixth location 
- exact_coordinates_6
- Indicator of coordinate precision (6th) 
- page
- Source page in the original report 
- additional_comments
- Additional remarks or context 
Details
The dataset name has been kept as pinochet_regime_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix df indicates that the dataset is a data frame. The original content has not been modified.
Source
Data taken from the pinochet package version 0.1.0.
Official Codes for Chilean Communes, Provinces, and Regions
Description
This dataset, territorial_codes_tbl_df, is a tibble containing official codes for communes, provinces, and regions in Chile. The codes were provided by the Chilean government agency SUBDERE. The names of the administrative divisions were converted to ASCII characters to avoid encoding issues. All variable names and data values are in Spanish, as retrieved from the original source.
Usage
data(territorial_codes_tbl_df)
Format
A tibble with 346 observations and 6 variables:
- codigo_comuna, nombre_comuna
- Official commune code and commune name (character, in Spanish) 
- codigo_provincia, nombre_provincia
- Official province code and province name (character, in Spanish) 
- codigo_region, nombre_region
- Official region code and region name (character, in Spanish) 
Details
The dataset name has been kept as 'territorial_codes_tbl_df' to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ChileDataAPI package and assists users in identifying its specific characteristics. The suffix 'df' indicates that the dataset is a data frame. The original content has not been modified in any way.
Source
Data taken from the chilemapas package version 0.3.0
View Available Datasets in ChileDataAPI
Description
This function lists all datasets available in the 'ChileDataAPI' package. If the 'ChileDataAPI' package is not loaded, it stops and shows an error message. If no datasets are available, it returns a message and an empty vector.
Usage
view_datasets_ChileDataAPI()
Value
A character vector with the names of the available datasets. If no datasets are found, it returns an empty character vector.
Examples
if (requireNamespace("ChileDataAPI", quietly = TRUE)) {
  library(ChileDataAPI)
  view_datasets_ChileDataAPI()
}