Git Product home page Git Product logo

junr's Introduction

junr

Travis-CI Build Status Coverage Status CRAN Status Badge

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, and the City of San Jose. Others are listed on the Junar website.

Installation

install.packages("devtools")
devtools::install_github("FvD/junr")

Usage

For a full example, please consult the package vignette.

Load the package and set URL and API-Key

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

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

data_guid <- "COMPR-PUBLI-DEL-MINIS"
purchasing_data <- get_data(base_url, api_key, data_guid)

Determine data dimensions

get_dimensions(base_url, api_key)

Clean up currency data

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 y la Ciudad de Córdoba (Argentina) entre otros. Otros se pueden encontrar en el sitio web de Junar.

Instalación

Para instalar este paquete desde Github es necesario tener el paquete devtools instalado:

install.packages("devtools")
devtools::install_github("FvD/junr")

Uso

Para un ejemplo completo por favor consulta la documentación.

Carga el paquete y define el URL y API-Key

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

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

guid_datos <- "COMPR-PUBLI-DEL-MINIS"
datos_compras <- get_data(url_base, api_key, guid_datos)

Determina la cantidad de datos disponibles

get_dimensions(url_base, api_key)

Limpiar valores de divisas

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

junr's People

Contributors

fvd avatar maurolepore avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.