Type: | Package |
Title: | Access Colombia's Public Data via 'API-Colombia' |
Version: | 0.1.1 |
Maintainer: | Renzo Caceres Rossi <arenzocaceresrossi@gmail.com> |
Description: | Provides a seamless interface to access diverse public data about Colombia through the 'API-Colombia', a RESTful API. The package enables users to explore various aspects of Colombia, including general information, geography, and cultural insights. It includes five API-related functions to retrieve data on topics such as Colombia's general information, airports, departments, regions, and presidents. Additionally, 'ColombiAPI' offers a built-in function to view the datasets available within the package. The package also includes curated datasets covering Bogota air stations, business and holiday dates, public schools, Colombian coffee exports, cannabis licenses, Medellin rainfall, and malls in Bogota, making it a comprehensive tool for exploring Colombia's data. For more details on the 'API-Colombia', see https://api-colombia.com/. |
License: | GPL-3 |
URL: | https://github.com/lightbluetitan/colombiapi, https://lightbluetitan.github.io/colombiapi/ |
BugReports: | https://github.com/lightbluetitan/colombiapi/issues |
Encoding: | UTF-8 |
LazyData: | false |
Suggests: | ggplot2, testthat (≥ 3.0.0), knitr, rmarkdown |
Imports: | httr, jsonlite, dplyr, magrittr |
RoxygenNote: | 7.3.2 |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2025-02-16 04:45:05 UTC; renzocrossi |
Author: | Renzo Caceres Rossi [aut, cre] |
Depends: | R (≥ 3.5.0) |
Repository: | CRAN |
Date/Publication: | 2025-02-16 06:10:02 UTC |
ColombiAPI: Access Colombia's Public Data via API-Colombia
Description
This package provides access to information about Colombia through the API-Colombia, a public RESTful API that enables users to obtain a variety of public information about Colombia,including general information, geography, and cultural insights.
Details
ColombiAPI: Access Colombia's Public Data via API-Colombia
Access Colombia's Public Data via API-Colombia.
Author(s)
Maintainer: Renzo Caceres Rossi arenzocaceresrossi@gmail.com
See Also
Useful links:
Bogota Air Stations Coordinates
Description
This dataset, Bogota_airstations_df, is a data frame containing the coordinates of air quality measurement stations in Bogota, Colombia.
Usage
data(Bogota_airstations_df)
Format
A data frame with 10 observations and 3 variables:
- ESTACION
Character string representing the name of the station.
- X
Numeric value representing the X coordinate of the station.
- Y
Numeric value representing the Y coordinate of the station.
Details
The dataset name has been kept as Bogota_airstations_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI 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
Originally taken from the SpatFD package version 0.0.1
Bogota Business Dates
Description
This dataset, Bogota_business_Date, is a Date object containing the business dates for Bogota, Colombia.
Usage
data(Bogota_business_Date)
Format
A Date object with 27,173 observations:
- Bogota_business_Date
Date object representing the business dates in Bogota, Colombia, ranging between "1990-01-02" and "2100-12-31".
Details
The dataset name has been kept as Bogota_business_Date to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI package and assists users in identifying its specific characteristics. The suffix '_Date' indicates that the dataset is an object of the Date class. The original content has not been modified in any way.
Source
Originally taken from the quantdates package version 2.0.4.
Bogota Holidays Dates
Description
This dataset, Bogota_holidays_Date, is a Date object containing the official holidays of Bogota, Colombia.
Usage
data(Bogota_holidays_Date)
Format
A Date object with 1787 observations:
- Bogota_holidays_Date
Date object representing the official holidays in Bogota, Colombia, ranging between "1990-01-01" and "2100-12-08".
Details
The dataset name has been kept as Bogota_holidays_Date to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI package and assists users in identifying its specific characteristics. The suffix '_Date' indicates that the dataset is an object of the Date class. The original content has not been modified in any way.
Source
Originally taken from the quantdates package version 2.0.4.
Holidays were created using the bizdays
package.
Bogota Malls Information
Description
This dataset, Bogota_malls_tbl_df, is a tibble containing detailed information about shopping malls located in Bogota, Colombia. It includes the mall names, physical addresses, web URLs, geographical coordinates, and the locality to which each mall belongs.
Usage
data(Bogota_malls_tbl_df)
Format
A tibble with 42 observations and 6 variables:
- NAME
Character string representing the name of the shopping mall.
- ADDRESS
Character string representing the physical address of the mall.
- URL
Character string representing the web URL of the mall.
- LATITUD
Numeric value representing the latitude of the mall.
- LONGITUD
Numeric value representing the longitude of the mall.
- LOCALIDAD
Character string representing the locality the mall belongs to.
Details
The dataset name has been kept as Bogota_malls_tbl_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI package and assists users in identifying its specific characteristics. The suffix 'tbl_df' indicates that the dataset is a tibble. The original content has not been modified in any way.
Source
Originally taken from Kaggle, url: https://www.kaggle.com/datasets/erik172/bogota-shopping-malls.
Cannabis Licenses Information
Description
This dataset, Cannabis_Licenses_tbl_df, is a tibble containing detailed information about cannabis-related licenses issued by the Ministry of Justice and Law in Colombia. It includes data on the number of received, denied, archived, modified, and granted licenses for cannabis cultivation, as well as the licenses issued for both psychoactive and non-psychoactive cannabis plants.
Usage
data(Cannabis_Licenses_tbl_df)
Format
A tibble with 92 observations and 10 variables:
- Mes
Character string representing the month in which the data was recorded.
- Solicitudes de licencias recibidas
Numeric value representing the number of license requests received.
- Solicitudes Negadas
Numeric value representing the number of denied license requests.
- Solicitudes Archivadas
Numeric value representing the number of archived license requests.
- Solicitudes Modificadas
Numeric value representing the number of modified license requests.
- Licencias Otorgadas
Numeric value representing the number of licenses granted.
- Licencias expedidas de semillas para siembra
Numeric value representing the number of seed cultivation licenses issued.
- Licencias expedidas de plantas cannabis psicoactivo
Numeric value representing the number of psychoactive cannabis plant cultivation licenses issued.
- Licencias expedidas de plantas cannabis no psicoactivo
Numeric value representing the number of non-psychoactive cannabis plant cultivation licenses issued.
- Año
Numeric value representing the year in which the data was recorded.
Details
The dataset name has been kept as Cannabis_Licenses_tbl_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI package and assists users in identifying its specific characteristics. The suffix 'tbl_df' indicates that the dataset is a tibble. The original content has not been modified in any way.
Source
Originally taken from Kaggle, url: https://www.kaggle.com/datasets/josetroyatoscano/licencias-cannabis-colombia-full-dataset-feb-2024
Colombian Coffee 2016 Export/Import
Description
This dataset, Colombia_coffee_tbl_df, is a tibble containing detailed information about Colombian coffee exports and imports in 2016. It includes data on various factors such as trade flow, commodity codes, trade value, weight in kilograms, and information about the countries involved in the trade. The dataset is sourced from Kaggle and provides a comprehensive analysis of the foreign trade of Colombian coffee.
Usage
data(Colombia_coffee_tbl_df)
Format
A tibble with 106 observations and 35 variables:
- Classification
Character string representing the classification of the coffee product.
- Year
Numeric value representing the year of the data entry.
- Period
Numeric value representing the period of the trade.
- Period Desc.
Numeric value representing the period description.
- Aggregate Level
Numeric value representing the aggregate level of the trade data.
- Is Leaf Code
Numeric value indicating whether the trade involves a leaf product.
- Trade Flow Code
Numeric value representing the trade flow code.
- Trade Flow
Character string representing the flow of the trade, either export or import.
- Reporter Code
Numeric value representing the code of the reporting country.
- Reporter
Character string representing the reporting country.
- Reporter ISO
Character string representing the ISO code of the reporting country.
- Partner Code
Numeric value representing the code of the partner country.
- Partner
Character string representing the partner country.
- Partner ISO
Character string representing the ISO code of the partner country.
- 2nd Partner Code
Logical value indicating if there is a second partner country involved in the trade.
- 2nd Partner
Logical value indicating if there is a second partner country.
- 2nd Partner ISO
Logical value indicating if there is a second partner country's ISO code.
- Customs Proc. Code
Logical value representing the customs procedure code.
- Customs
Logical value indicating whether customs procedure information is available.
- Mode of Transport Code
Logical value representing the mode of transport code.
- Mode of Transport
Logical value indicating the mode of transport used in the trade.
- Commodity Code
Character string representing the commodity code for coffee.
- Commodity
Character string representing the commodity (coffee).
- Qty Unit Code
Numeric value representing the quantity unit code.
- Qty Unit
Character string representing the unit of quantity for the trade.
- Qty
Logical value representing the quantity of coffee in the trade.
- Alt Qty Unit Code
Logical value representing an alternative quantity unit code.
- Alt Qty Unit
Numeric value representing an alternative quantity unit for the trade.
- Alt Qty
Logical value representing an alternative quantity for the trade.
- Netweight (kg)
Numeric value representing the net weight of the coffee in kilograms.
- Gross weight (kg)
Logical value indicating the gross weight of the coffee in kilograms.
- Trade Value (US)
Numeric value representing the trade value in US dollars.
- CIF Trade Value (US)
Logical value representing the CIF trade value in US dollars.
- FOB Trade Value (US)
Logical value representing the FOB trade value in US dollars.
- Flag
Numeric value representing a flag for the dataset entry.
Details
The dataset name has been kept as Colombia_coffee_tbl_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI package and assists users in identifying its specific characteristics. The suffix 'tbl_df' indicates that the dataset is a tibble. The original content has not been modified in any way.
Source
Originally taken from Kaggle, url: https://www.kaggle.com/datasets/carlosbeltranv/colombian-coffee-2016
Medellin Rainfall Information
Description
This dataset, Medellin_rain_tbl_df, is a tibble containing information about rainfall measurements in Medellin, Colombia, including station identifiers, geographical coordinates, date of observation, and rainfall values.
Usage
data(Medellin_rain_tbl_df)
Format
A tibble with 185,705 observations and 8 variables:
- station_id
Numeric identifier for the rain observation station.
- lat
Numeric value representing the latitude of the station.
- lon
Numeric value representing the longitude of the station.
- date
Date of the rainfall observation.
- year
Numeric year of the observation.
- month
Numeric month of the observation.
- day
Numeric day of the observation.
- rainfall
Numeric value representing the amount of rainfall in millimeters.
Details
The dataset name has been kept as Medellin_rain_tbl_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI package and assists users in identifying its specific characteristics. The suffix 'tbl_df' indicates that the dataset is a tibble. The original content has not been modified in any way.
Source
Originally taken from the tidychangepoint package version 0.0.1.
Tulua Public Schools Information
Description
This dataset, Tulua_Public_Schools_tbl_df, is a tibble containing detailed information about public schools located in the municipality of Tulua, Valle del Cauca, Colombia. It includes the name, location, contact information, and the geographical coordinates of each institution, as well as specific details about each school and its facilities.
Usage
data(Tulua_Public_Schools_tbl_df)
Format
A tibble with 105 observations and 8 variables:
- COD_DANE_INS
Numeric code representing the educational institution's DANE code.
- INSTITUCION
Character string representing the name of the public school.
- SEDE
Character string representing the name of the specific school location or branch.
- COD_DANE_SEDE
Numeric code representing the DANE code of the specific school branch.
- TELEFONO
Character string representing the phone number of the school.
- CORREOS
Character string representing the email addresses of the school.
- DIRECCIÓN
Character string representing the physical address of the school.
- CORDE_GEO
Character string representing the geographical coordinates of the school.
Details
The dataset name has been kept as Tulua_Public_Schools_tbl_df to avoid confusion with other datasets in the R ecosystem. This naming convention helps distinguish this dataset as part of the ColombiAPI package and assists users in identifying its specific characteristics. The suffix 'tbl_df' indicates that the dataset is a tibble. The original content has not been modified in any way.
Source
Originally taken from GOV.CO, url: https://www.datos.gov.co/Educaci-n/Listado-de-colegios-p-blicos-del-municipio-de-Tulu/scz9-f8ud/about_data
Get Information About Colombia
Description
This function makes an API call https://api-colombia.com/api/v1/Country/Colombia to retrieve information about Colombia, such as its name, surface area, population, time zone, currency, and region. It processes the API response and returns the data in a structured data.frame.
Usage
get_Colombia_info()
Details
The function sends a GET request to the API at
https://api-colombia.com/api/v1/Country/Colombia. If the API returns
a successful response (status code 200), the data is parsed and returned.
If the response is unsuccessful or the structure is not as expected,
the function will return NULL
.
Value
A 'data.frame' with the following columns:
-
name
: Name of the country. -
surface
: The surface area of the country in square kilometers. -
population
: The population of the country. -
timeZone
: The time zone of the country. -
currency
: The currency used in the country. -
currencySymbol
: The currency symbol. -
region
: The region of the country in the world.
Note
Ensure you have an active internet connection to access the API. If the API structure changes or the API becomes unavailable, the function may need modifications.
This function relies on the following packages: httr
and jsonlite
.
These packages are used for making HTTP requests and processing JSON responses, respectively.
Examples
## Not run:
# Call the function to get Colombia information
colombia_info <- get_Colombia_info()
# Print the result
print(colombia_info)
## End(Not run)
Get the List of Airports in Colombia
Description
This function retrieves a list of airports in Colombia from the public API "https://api-colombia.com/api/v1/Airport" and returns a data frame containing selected information about each airport, ordered by airport name in alphabetical order.
Usage
get_airports_list()
Details
This function sends a GET request to the API, processes the JSON response,
and converts it into a structured data frame. The data is filtered and formatted
to include only relevant columns, and it is ordered by the name
column in
alphabetical order (A to Z).
If the API returns a status code of 400, the function issues a warning message to inform the user of the error. Any other unexpected API response is not explicitly handled and may cause the function to fail.
Value
A data frame with the following columns:
-
id
: The unique identifier of the airport. -
name
: The name of the airport. -
iataCode
: The IATA code of the airport (if available). -
oaciCode
: The OACI code of the airport (if available). -
type
: The type of airport (e.g., commercial, private). -
longitude
: The geographical longitude of the airport. -
latitude
: The geographical latitude of the airport.
Note
Ensure you have an active internet connection to access the API. If the API structure changes or the API becomes unavailable, the function may need modifications.
This function relies on the following packages: httr
, jsonlite
, dplyr
, and magrittr
.
The %>%
operator, used for chaining commands, is provided by the magrittr
package.
See Also
GET
,
fromJSON
,
select
,
arrange
Examples
## Not run:
# Retrieve the list of airports
airports <- get_airports_list()
# Print the data frame
print(airports)
# View the data in a spreadsheet-like interface
View(airports)
# Select airports located in a specific city (e.g., Bogotá)
bogota_airports <- airports %>%
filter(grepl("Bogotá", name))
print(bogota_airports)
## End(Not run)
Get the List of Departments in Colombia
Description
This function retrieves a list of departments in Colombia from the public API "https://api-colombia.com/api/v1/Department" and returns a data frame containing selected information about each department, ordered by department name in alphabetical order.
Usage
get_departments_list()
Details
This function sends a GET request to the API, processes the JSON response,
and converts it into a structured data frame. The data is filtered and formatted
to include only relevant columns (id
, name
, surface
, population
),
and it is ordered by the name
column in alphabetical order (A to Z).
If the API returns a status code other than 200, the function issues a message
with the status code received and returns NULL
.
Value
A data frame with the following columns:
-
id
: The unique identifier of the department. -
name
: The name of the department. -
surface
: The surface area of the department in square kilometers. -
population
: The population of the department.
Note
Ensure you have an active internet connection to access the API. If the API structure changes or the API becomes unavailable, the function may need modifications.
This function relies on the following packages: httr
, jsonlite
, dplyr
, and magrittr
.
The %>%
operator, used for chaining commands, is provided by the magrittr
package.
See Also
GET
,
fromJSON
,
select
,
arrange
Examples
## Not run:
# Retrieve the list of departments
departments <- get_departments_list()
# Print the data frame
print(departments)
# View the data in a spreadsheet-like interface
View(departments)
# Select departments with a specific population range
large_departments <- departments %>%
filter(population > 1000000)
print(large_departments)
## End(Not run)
Get the List of Presidents of Colombia
Description
This function retrieves the list of presidents of Colombia from the public API "https://api-colombia.com/api/v1/President" and returns a data frame containing selected information about each president, ordered by their start period date in descending order (most recent first).
Usage
get_presidents_list()
Details
This function sends a GET request to the API, processes the JSON response,
and converts it into a structured data frame. The data is filtered and formatted
to include only relevant columns, and it is ordered by the startPeriodDate
column
in descending order.
If the API returns a status code of 400, the function issues a warning message to inform the user of the error. Any other unexpected API response is not explicitly handled and may cause the function to fail.
Value
A data frame with the following columns:
-
id
: The unique identifier of the president. -
name
: The first name of the president. -
lastName
: The last name of the president. -
startPeriodDate
: The start date of the presidential period (in ISO 8601 format). -
endPeriodDate
: The end date of the presidential period (in ISO 8601 format). -
politicalParty
: The political party of the president.
Note
Ensure you have an active internet connection to access the API. If the API structure changes or the API becomes unavailable, the function may need modifications.
This function relies on the following packages: httr
, jsonlite
, dplyr
, and magrittr
.
The %>%
operator, used for chaining commands, is provided by the magrittr
package.
See Also
GET
,
fromJSON
,
select
,
arrange
Examples
## Not run:
# Retrieve the list of presidents
presidents <- get_president_list()
# Print the data frame
print(presidents)
# View the data in a spreadsheet-like interface
View(presidents)
# Select presidents from a specific political party
library(dplyr)
liberal_presidents <- presidents %>%
filter(politicalParty == "Liberal")
print(liberal_presidents)
## End(Not run)
Get the List of Regions in Colombia
Description
This function retrieves a list of regions in Colombia from the public API "https://api-colombia.com/api/v1/Region" and returns a data frame containing selected information about each region, ordered by region name in alphabetical order.
Usage
get_regions_list()
Details
This function sends a GET request to the API, processes the JSON response,
and converts it into a structured data frame. The data is filtered and formatted
to include only relevant columns (id
and name
), and it is ordered
by the name
column in alphabetical order (A to Z).
If the API returns a status code other than 200, the function issues a message
with the status code received and returns NULL
.
Value
A data frame with the following columns:
-
id
: The unique identifier of the region. -
name
: The name of the region.
Note
Ensure you have an active internet connection to access the API. If the API structure changes or the API becomes unavailable, the function may need modifications.
This function relies on the following packages: httr
, jsonlite
, dplyr
, and magrittr
.
The %>%
operator, used for chaining commands, is provided by the magrittr
package.
See Also
GET
,
fromJSON
,
select
,
arrange
Examples
## Not run:
# Retrieve the list of regions
regions <- get_regions_list()
# Print the data frame
print(regions)
# View the data in a spreadsheet-like interface
View(regions)
# Select regions with specific characteristics (e.g., starting with "Atlántico")
atlantic_regions <- regions %>%
filter(grepl("^Atlántico", name))
print(atlantic_regions)
## End(Not run)
View Available Datasets in ColombiAPI
Description
This function lists all datasets available in the 'ColombiAPI' package. If the 'ColombiAPI' 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()
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("ColombiAPI", quietly = TRUE)) {
library(ColombiAPI)
view_datasets()
}