FvD / junr

Access Open Data Through the Junar API
https://fvd.github.io/junr/
Other
1 stars 8 forks source link

Data pull problem #3

Closed ronnyhdez closed 7 years ago

ronnyhdez commented 7 years ago

I have been using the junr package in order to pull some datasets that are in the web page of the Ministerio de Economía y Finanzas de Perú but there is a problem.

I already have my API Key, I get in R a list with the names of the datasets that can be found there, but, when I try to call one of those datasets, R just create an empty dataframe (0 rows, 0 columns).

This is what I´ve been doing:

`url_base <- "http://api.datosabiertos.mef.gob.pe/api/v2/datastreams/" api_key <- "the number of the API Key"

get_index(url_base, api_key)

list_titles(url_base, api_key)

guid_datos <- "PRESU-INSTI-MODIF-PIM" datos_compras <- get_data(url_base,api_key,guid_datos)

head(datos_compras)`

FvD commented 7 years ago

I'm trying to repeat the issue and I notice hat the GUID "PRESU-INSTI-MODIF-PIM" does not appear in the listing of available data (as returned by the API). Just to makes sure that this is indeed the problem, could you please try and run the following:

library(junr)
url_base <- "http://api.datosabiertos.mef.gob.pe/api/v2/datastreams/"
api_key <- "your-key"
indice <- get_index(url_base, api_key)
lista <- list_titles(url_base, api_key)
guid_datos <- "ESTAD-DE-SITUA-FINAN-2014"
datos <- get_data(url_base, api_key, guid_datos)
head(datos)

This returns data, whereas the GUID that you are using returns the empty dataframe that you are describing.

The difference here is that you can have a look at the available data sets using View(indice). It will show you a data frame with titles and GUID of all available datasets.

ronnyhdez commented 7 years ago

Thanks Frans..!