Skip to content

Commit

Permalink
data(kostra_dwd_2020): fnames
Browse files Browse the repository at this point in the history
  • Loading branch information
dimfalk committed Apr 3, 2024
1 parent 31f7141 commit a34796e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions data-raw/kostra_dwd_2020.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ d <- c(5, 10, 15, 20, 30, 45, 60, 90, 120, 180, 240, 360, 540, 720, 1080, 1440,

d_pad <- stringr::str_pad(d, width = 5, pad = "0")

files <- paste0("GIS_KOSTRA-DWD-2020_D", d_pad,".zip")
fnames <- paste0("GIS_KOSTRA-DWD-2020_D", d_pad,".zip")

urls <- paste0(source, files)
urls <- paste0(source, fnames)

for (i in 1:length(files)) {
for (i in 1:length(fnames)) {

utils::download.file(urls[i], files[i])
utils::download.file(urls[i], fnames[i])

utils::unzip(files[i])
utils::unzip(fnames[i])

unlink(files[i])
unlink(fnames[i])
}

files_shp <- list.files(pattern = "*.shp", recursive = TRUE)
files_shp <- list.files(pattern = "shp$", recursive = TRUE)

kostra_dwd_2020 <- list()

Expand All @@ -41,4 +41,4 @@ for (i in 1:length(d)) {

usethis::use_data(kostra_dwd_2020, overwrite = TRUE)

unlink(files |> stringr::str_sub(1, -5), recursive = TRUE)
stringr::str_sub(fnames, 1, -5) |> unlink(recursive = TRUE)

0 comments on commit a34796e

Please sign in to comment.