download_data: Download files asociate with dataesgobr object

Description Usage Arguments Examples

Description

This function downloads the data associated with the dataset passed like param from datos.gob.es

Usage

1
2
download_data(x, format, all = TRUE, position = 0, noconfirm = FALSE,
  overwrite = NULL, outfile = NULL)

Arguments

x

A dataesgobr containing information and data from datos.gob.es

format

A string, the data's format to download

all

A logical, this parameter indicates if the function must download every file

position

Numeric, the number in the format list

noconfirm

Logical, this parameter indicates if the user must confirm the downloads or no

overwrite

A logical, if this parameter is TRUE then the downloaded file will replace automatically the old file if it exists

outfile

A string, the user can indicates the path to save the file

Examples

1
2
3
4
5
6
7
8
9
library(dataesgobr)

id <- "l01280066-horarios-de-metro1"
dataset <- search_by_id(id)
download_data(dataset, "text/csv", noconfirm = TRUE, outfile = tempdir())
download_data(dataset, "text/csv", noconfirm = TRUE, overwrite = TRUE, outfile = tempdir())
download_data(dataset, "text/csv", FALSE, 1, noconfirm = TRUE)
download_data(dataset, "text/csv", FALSE, 1, noconfirm = TRUE, overwrite = TRUE)
download_data(dataset, "application/pdf", TRUE, noconfirm = TRUE, outfile = tempdir())

dataesgobr documentation built on June 18, 2019, 5:04 p.m.