Adapt geolocalized Sirene data
adapt_geo_sirene.Rd
adapt_geo_sirene()
adapt geolocalized Sirene database to a common format.
Usage
adapt_geo_sirene(
origin,
destination,
archive,
scheme = floodam.data::scheme_sirene_2019,
projection = 4326,
active = TRUE,
path_eaip = NULL,
path_admin = NULL,
journal = TRUE,
map = !is.null(path_eaip),
verbose = TRUE,
retrieve = FALSE
)
Arguments
- origin
character, path to the directory where archive are stored.
- destination
character, path to the directory where results should be saved.
- archive
character, vector of archive to be adpated.
- scheme
data.frame, how archive variables should be treated.
- projection
numeric, 4 digits projection to use.
- active
logical, should only active activities be kept.
- path_eaip
character, path where eaip archives should be find.
- path_admin
character, path where administrative archives should be find.
- journal
logical, should a journal file be saved.
- map
logical, should a map be plotted (for check purpose).
- verbose
logical, should the function give some sumup informations.
- retrieve
logical, should the result be returned.
Details
The following treatments are performed:
Only some fileds are selected, field names (colnames) are consistently set.
NA values are consistently set.
Type of fields are consistently set, some checks are performed on transformations.
Data set is cut and saved by departments
Only observations with spatial coordinates are kept.
Exposition of observations (belonging or not to eaip) is added.
Examples
if (FALSE) {
dest = tempdir()
download_geo_sirene(dest, "data.gouv", scope = "department", version = "976")
archive = "geo_siret_976.csv.gz"
origin = file.path(dest, "version_2019", "2024-03")
dest = file.path(dest, "adapted")
result = adapt_geo_sirene(origin, dest, retrieve = TRUE)
unlink(dest)
}