Explore datasets by keywords and publishers in https://datos.gob.es/

openes_keywords(keyword, publisher)

Arguments

keyword

A character string specifying a keyword to identify a data set. For example, 'vivienda'.

publisher

A character string with the publisher code. Should be only one publisher code. See publishers_available for the permitted publisher codes.

Value

A tibble containing the matched datasets.

Details

openes_keywords works only for searching for one keyword for a given publisher. For example, 'viviendas' for the Ayuntamiento of Barcelona. If there are no matches for a keyword-publisher combination, openes_keywords will raise an error stating that there are no matches.

openes_keywords returns a data frame with the following columns:

  • description: a short description of each of the matched datasets in Spanish (Spanish is set as default if available, if not, then the first non-spanish language is chosen).

  • publisher: the entity that publishes the dataset. See openes_load_publishers for all available publishers.

  • is_readable: whether that dataset is currently readable by openes_load. See permitted_formats for currently available formats.

  • path_id: the end path that identifies that dataset in the https://datos.gob.es/ API.

  • url: the complete url of the dataset in https://datos.gob.es/. Note that this URL is not the access URL to the dataset but to the dataset's homepage in https://datos.gob.es/.

In most cases the user will need to narrow down their search because the result of openes_keywords will have too many datasets. Beware that for passing the result of this function to openes_load the final data frame needs to be narrowed down to only one dataset (that is, 1 row) and the structure needs to be the same as from the original output of openes_keywords (same column names, in the same order). See examples below.

See also

Examples

if (FALSE) { library(dplyr) kw <- openes_keywords("vivienda", "l01080193") # Ayuntamiento de Barcelona kw # Notice how we narrow down to only 1 dataset dts <- kw filter(grepl("Precios", description)) openes_load('ASCII') # Notice that we had to specify the encoding because printing the dataset returns an error. # If that happens to you, try figuring out the encoding with readr::guess_encoding(dts$data[[1]]) # and specify the most likely encoding in `openes_load` dts$metadata dts$data }