add read / write from / to csv and move checking directory to helpers
This commit is contained in:
@@ -43,18 +43,7 @@ fetch_all <- function(download_dir="records/", create=FALSE) {
|
||||
if (str_sub(download_dir, -1) != .Platform$file.sep)
|
||||
download_dir <- str_c(download_dir, .Platform$file.sep)
|
||||
|
||||
# check if download_dir exists
|
||||
if(file.access(download_dir, mode=0) == -1) {
|
||||
if (create) {
|
||||
tryCatch(dir.create(download_dir),
|
||||
error = stop_dir_not_creatable,
|
||||
warning = stop_dir_not_creatable)
|
||||
} else {
|
||||
stop("Directory does not exist. Use create = TRUE if you wish to create the directory.")
|
||||
}
|
||||
} else if (file.access(download_dir, mode=2) == -1) {
|
||||
stop("Directory exists, but is not writeable.")
|
||||
}
|
||||
check_directory(download_dir, create)
|
||||
cat("Fetching all available records from bundestag.de. This may take a while ...\n")
|
||||
|
||||
# create progress bar
|
||||
|
||||
Reference in New Issue
Block a user