Learn R Programming

dataesgobr (version 1.0.0)

download_data: Download files asociate with dataesgobr object

Description

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

Usage

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

Run this code
# NOT RUN {
library(dataesgobr)
# }
# NOT RUN {
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())
# }

Run the code above in your browser using DataLab