Title: | Access Colombia's Public Data via API-Colombia |
---|---|
Description: | ColombiAPI 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. |
Authors: | Renzo Caceres Rossi [aut, cre] |
Maintainer: | Renzo Caceres Rossi <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-01-10 05:28:37 UTC |
Source: | https://github.com/lightbluetitan/colombiapi |
This dataset, Bogota_airstations_df, is a data frame containing the coordinates of air quality measurement stations in Bogota, Colombia.
data(Bogota_airstations_df)
data(Bogota_airstations_df)
A data frame with 10 observations and 3 variables:
Character string representing the name of the station.
Numeric value representing the X coordinate of the station.
Numeric value representing the Y coordinate of the station.
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.
Originally taken from the SpatFD package version 0.0.1. Data provided by the Secretaria de Ambiente de Bogotá: Monitor network of air quality of Bogota http://rmcab.ambientebogota.gov.co
This dataset, Bogota_business_Date, is a Date object containing the business dates for Bogota, Colombia.
data(Bogota_business_Date)
data(Bogota_business_Date)
A Date object with 27,173 observations:
Date object representing the business dates in Bogota, Colombia, ranging between "1990-01-02" and "2100-12-31".
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.
Originally taken from the quantdates package version 2.0.4.
This dataset, Bogota_holidays_Date, is a Date object containing the official holidays of Bogota, Colombia.
data(Bogota_holidays_Date)
data(Bogota_holidays_Date)
A Date object with 1787 observations:
Date object representing the official holidays in Bogota, Colombia, ranging between "1990-01-01" and "2100-12-08".
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.
Originally taken from the quantdates package version 2.0.4.
Holidays were created using the bizdays
package.
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.
data(Bogota_malls_tbl_df)
data(Bogota_malls_tbl_df)
A tibble with 42 observations and 6 variables:
Character string representing the name of the shopping mall.
Character string representing the physical address of the mall.
Character string representing the web URL of the mall.
Numeric value representing the latitude of the mall.
Numeric value representing the longitude of the mall.
Character string representing the locality the mall belongs to.
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.
Originally taken from Kaggle, url: https://www.kaggle.com/datasets/erik172/bogota-shopping-malls.
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.
data(Cannabis_Licenses_tbl_df)
data(Cannabis_Licenses_tbl_df)
A tibble with 92 observations and 10 variables:
Character string representing the month in which the data was recorded.
Numeric value representing the number of license requests received.
Numeric value representing the number of denied license requests.
Numeric value representing the number of archived license requests.
Numeric value representing the number of modified license requests.
Numeric value representing the number of licenses granted.
Numeric value representing the number of seed cultivation licenses issued.
Numeric value representing the number of psychoactive cannabis plant cultivation licenses issued.
Numeric value representing the number of non-psychoactive cannabis plant cultivation licenses issued.
Numeric value representing the year in which the data was recorded.
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.
Originally taken from Kaggle, url: https://www.kaggle.com/datasets/josetroyatoscano/licencias-cannabis-colombia-full-dataset-feb-2024
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.
data(Colombia_coffee_tbl_df)
data(Colombia_coffee_tbl_df)
A tibble with 106 observations and 35 variables:
Character string representing the classification of the coffee product.
Numeric value representing the year of the data entry.
Numeric value representing the period of the trade.
Numeric value representing the period description.
Numeric value representing the aggregate level of the trade data.
Numeric value indicating whether the trade involves a leaf product.
Numeric value representing the trade flow code.
Character string representing the flow of the trade, either export or import.
Numeric value representing the code of the reporting country.
Character string representing the reporting country.
Character string representing the ISO code of the reporting country.
Numeric value representing the code of the partner country.
Character string representing the partner country.
Character string representing the ISO code of the partner country.
Logical value indicating if there is a second partner country involved in the trade.
Logical value indicating if there is a second partner country.
Logical value indicating if there is a second partner country's ISO code.
Logical value representing the customs procedure code.
Logical value indicating whether customs procedure information is available.
Logical value representing the mode of transport code.
Logical value indicating the mode of transport used in the trade.
Character string representing the commodity code for coffee.
Character string representing the commodity (coffee).
Numeric value representing the quantity unit code.
Character string representing the unit of quantity for the trade.
Logical value representing the quantity of coffee in the trade.
Logical value representing an alternative quantity unit code.
Numeric value representing an alternative quantity unit for the trade.
Logical value representing an alternative quantity for the trade.
Numeric value representing the net weight of the coffee in kilograms.
Logical value indicating the gross weight of the coffee in kilograms.
Numeric value representing the trade value in US dollars.
Logical value representing the CIF trade value in US dollars.
Logical value representing the FOB trade value in US dollars.
Numeric value representing a flag for the dataset entry.
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.
Originally taken from Kaggle, url: https://www.kaggle.com/datasets/carlosbeltranv/colombian-coffee-2016
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.
ColombiAPI: Access Colombia's Public Data via API-Colombia
Access Colombia's Public Data via API-Colombia.
Maintainer: Renzo Caceres Rossi [email protected]
Useful links:
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.
get_airports_list()
get_airports_list()
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.
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.
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.
GET
,
fromJSON
,
select
,
arrange
## 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)
## 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)
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.
get_Colombia_info()
get_Colombia_info()
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
.
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.
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.
## Not run: # Call the function to get Colombia information colombia_info <- get_Colombia_info() # Print the result print(colombia_info) ## End(Not run)
## Not run: # Call the function to get Colombia information colombia_info <- get_Colombia_info() # Print the result print(colombia_info) ## End(Not run)
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.
get_departments_list()
get_departments_list()
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
.
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.
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.
GET
,
fromJSON
,
select
,
arrange
## 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)
## 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)
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).
get_presidents_list()
get_presidents_list()
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.
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.
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.
GET
,
fromJSON
,
select
,
arrange
## 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)
## 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)
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.
get_regions_list()
get_regions_list()
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
.
A data frame with the following columns:
id
: The unique identifier of the region.
name
: The name of the region.
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.
GET
,
fromJSON
,
select
,
arrange
## 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)
## 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)
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.
data(Medellin_rain_tbl_df)
data(Medellin_rain_tbl_df)
A tibble with 185,705 observations and 8 variables:
Numeric identifier for the rain observation station.
Numeric value representing the latitude of the station.
Numeric value representing the longitude of the station.
Date of the rainfall observation.
Numeric year of the observation.
Numeric month of the observation.
Numeric day of the observation.
Numeric value representing the amount of rainfall in millimeters.
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.
Originally taken from the tidychangepoint package version 0.0.1.
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.
data(Tulua_Public_Schools_tbl_df)
data(Tulua_Public_Schools_tbl_df)
A tibble with 105 observations and 8 variables:
Numeric code representing the educational institution's DANE code.
Character string representing the name of the public school.
Character string representing the name of the specific school location or branch.
Numeric code representing the DANE code of the specific school branch.
Character string representing the phone number of the school.
Character string representing the email addresses of the school.
Character string representing the physical address of the school.
Character string representing the geographical coordinates of the school.
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.
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
This function lists all the datasets available in the ColombiAPI package. It returns a character vector with the names of the datasets included in the package.
view_datasets()
view_datasets()
A character vector containing the names of the datasets available in the ColombiAPI package.
# List the datasets available in the ColombiAPI package view_datasets()
# List the datasets available in the ColombiAPI package view_datasets()