R/Import_2018.R

Defines functions import_2018

Documented in import_2018

#' Import Data from year 2018
#'
#' @param x parameter needs to be left empty
#'
#' @return Returns a spatial features point object containing all accidents available from Destatis
#' @export
#'
#'@importFrom sf read_sf
#' @importFrom sf st_as_sf
#' @importFrom sf st_transform
#' @importFrom stats setNames
#' @importFrom utils download.file
#' @importFrom utils unzip
#'

import_2018 <- function(x) {
  temp <- tempfile()
  download.file(
    "https://unfallatlas.statistikportal.de/app/UnfalldatenDownload/Unfallorte2018_LinRef_Shapefile.zip",
    temp
  )
  unzip(temp)
  y_18 <-
    read_sf("./Shapefile/Unfallorte2018_LinRef.shp",
            "Unfallorte2018_LinRef")
  y_18 <- st_as_sf(y_18)
  y_18 <- st_transform(y_18, 25832)
  return(y_18)
}
LaHa93/DestatisR documentation built on March 28, 2020, 12:19 p.m.