1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#' @rdname checkdirs
#' @export
checkHTMLdir <- function(dir,
subdir = TRUE,
extension = TRUE,
...) {
if (missing(dir)) {
dir <- tcltk::tk_choose.dir()
}
if (extension == TRUE) {
pat = ".html|.htm"
}
if (extension == FALSE) {
pat = ""
}
files <-
list.files(dir,
pattern = pat,
full.names = TRUE,
recursive = subdir)
if (length(files) == 0) {
stop("No HTML found")
}
txts <- character(length(files))
message("Importing HTML files...")
pb <- utils::txtProgressBar(max = length(files), style = 3)
for (i in 1:length(files)) {
txts[i] <- getHTML(files[i])
utils::setTxtProgressBar(pb, i)
}
close(pb)
names(txts) <- basename(files)
return(statcheck(txts, ...))
}
|