Function used to downlaod BAN

download_ban(
  destination,
  origin = "data.gouv",
  name = NULL,
  extension = NULL,
  date = NULL,
  version = NULL,
  department = NULL,
  region = NULL,
  verbose = TRUE
)

Arguments

destination

character, the address where data are stocked.

origin

character, either a keyword or the address from where data are downloaded. See details.

name

character, vector of acceptable names for archive to be downloaded.

extension

character, vector of acceptable types of archive to be downloaded.

date

character, date of the archive to be downloaded.

version

string, version of BAN to be downloaded. See details.

department

integer, or converted to integer. Departments that should be considered. See details.

region

integer, or converted to integer. Regions that should be considered. See details.

verbose

logical, should the function send some messages while running.

Value

nothing

Details

If origin == "data.gouv", then all necessary variables are filled with those values:

  • origin is changed to "https://adresse.data.gouv.fr/data/ban/adresses"

  • name default value is changed to "adresses"

  • extension default value is changed to "csv.gz"

  • date default value is used to choose a given directory. If date is null, then the most recent version is taken (equivalent to "latest").

  • version must be something within "ban" or "bal". When "ban" is used the file with one position per address is used. When "bal" is used, the file with several position per address is used.

  • department is used. Should be admissible French departments (a formatting will be attempted with format_scope). If NULL, region may be used. If both are NULL, all departments from floodam.data::department will be used.

  • region may be used if department is null. Should be admissible French regions (a formatting will be attempted with format_scope). If region is given and department is NULL, all departments from given region will be used.

If not, everything shall be filled so that download_archive can make a successful download.

Examples

if (FALSE) {
destination = tempdir()
download_ban(destination)
download_ban(destination, department = 34)
download_ban(destination, department = 34, date = "2022-01-01")
download_ban(destination, region = 11, date = "2022-01-01")
download_ban(destination, department = 34, date = "2022-09-20", version = "bal")

unlink(destination)
}