https://github.com/fvd/junr
Access Open Data Through the Junar API
https://github.com/fvd/junr
government-data junar-api open-data open-datasets
Last synced: over 1 year ago
JSON representation
Access Open Data Through the Junar API
- Host: GitHub
- URL: https://github.com/fvd/junr
- Owner: FvD
- License: other
- Created: 2016-03-18T14:08:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-02-14T01:05:12.000Z (over 5 years ago)
- Last Synced: 2024-01-27T14:43:41.827Z (over 2 years ago)
- Topics: government-data, junar-api, open-data, open-datasets
- Language: R
- Homepage: https://fvd.github.io/junr/
- Size: 131 KB
- Stars: 1
- Watchers: 1
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# junr
[](https://travis-ci.org/FvD/junr)
[](https://codecov.io/github/FvD/junr?branch=master)
[](https://cran.r-project.org/package=junr)
## Access Open Data in R through the Junar API
The Junar API is the basis for a number of Open Data initiatives in Latin
America and the USA. The `junr` package is a wrapper to make it easier to
access data made public through the Junar API. Some examples of implementations
are: [the City of Pasadena](http://data.cityofpasadena.net/home/), and [the
City of San Jose](http://data.sanjoseca.gov/home/). Others are listed on the
[Junar website](http://junar.com/).
### Installation
```{r, eval=FALSE}
install.packages("devtools")
devtools::install_github("FvD/junr")
```
### Usage
For a full example, please consult the [package
vignette](http://rpubs.com/FvD/access-junar-api).
**Load the package and set URL and API-Key**
```{r}
library(junr)
base_url <- "http://api.datosabiertos.presidencia.go.cr/api/v2/datastreams/"
api_key <- "the-API-Key-from-the-corresponding-url"
```
With this connection information the `junr` package helps you to do the following:
**Get the index of data behind the base URL**
```{r, eval=FALSE}
get_index(base_url, api_key)
```
You can also just get a list of GUID's `list_guid(base_url, api_key)` or a list
of data set titles `list_titles(base_url, api_key)`.
**Get a particular data set**
```{r, eval=FALSE}
data_guid <- "COMPR-PUBLI-DEL-MINIS"
purchasing_data <- get_data(base_url, api_key, data_guid)
```
**Determine data dimensions**
```{r, eval=FALSE}
get_dimensions(base_url, api_key)
```
**Clean up currency data**
```{r, eval=FALSE}
currency_data <- get_data(base_url, api_key, "LICIT-ADJUD-POR-LOS-MINIS")
currency_data$`Monto Adjudicado` <- clean_currency(currency_data$`Monto Adjudicado`)
```
## Accede Datos a través del API de Junar en R
El API de Junar es la base para varias iniciativas de Datos Abiertos en Latino
América y los EEUU. El paquete `junr` facilita el acceso a estos datos des R.
El objetivo es fomentar el uso de los datos disponibles haciendo el acceso lo
mas fácil. Algunos ejemplos de implementaciones son: [el Portal de Datos
Abiertos del Gobierno de Costa
Rica](http://datosabiertos.presidencia.go.cr/home) y la Ciudad de Córdoba (Argentina)
entre otros. Otros se pueden encontrar en el [sitio web de Junar](http://junar.com/).
### Instalación
Para instalar este paquete desde Github es necesario tener el paquete
`devtools` instalado:
```{r, eval=FALSE}
install.packages("devtools")
devtools::install_github("FvD/junr")
```
### Uso
Para un ejemplo completo por favor consulta la [documentación](http://rpubs.com/FvD/acceder-junar-api).
**Carga el paquete y define el URL y API-Key**
```{r, eval=FALSE}
library(junr)
url_base <- "http://api.datosabiertos.presidencia.go.cr/api/v2/datastreams/"
api_key <- "El-API-Key-que-obtuviste-de-la-pagina"
```
**Obten un indice de los datos detras del URL**
```{r, eval=FALSE}
get_index(url_base, api_key)
```
Para tener solo una lista de los GUID la instrucción puedes usar
`list_guid(url_base, api_key)` o para solo un listado de los títulos:
`list_titles(url_base, api_key)`
**Obten un conjunto de datos determinado**
```{r, eval=FALSE}
guid_datos <- "COMPR-PUBLI-DEL-MINIS"
datos_compras <- get_data(url_base, api_key, guid_datos)
```
**Determina la cantidad de datos disponibles**
```{r, eval=FALSE}
get_dimensions(url_base, api_key)
```
**Limpiar valores de divisas**
```{r, eval=FALSE}
datos_con_divisas <- get_data(base_url, api_key, "LICIT-ADJUD-POR-LOS-MINIS")
datos_con_divisas$`Monto Adjudicado` <- clean_currency(datos_con_divisas$`Monto Adjudicado`)
```