# NOT RUN {
files <- dir(
system.file("docs", package = "textreadr"),
full.names = TRUE,
recursive = TRUE,
pattern = '\\.(R?md|Rd?$|txt|sql|html|pdf|doc|ppt|tex)'
)
max_wait <- 30
total <- length(files)
content <- vector(mode = "list", total)
for (i in seq_along(files)){
loop_counter(i, total, base_name(files[i]))
content[[i]] <- try_limit(
textreadr::read_document(files[i]),
max.time = max_wait,
zero.length.return = NA
)
}
sapply(content, is.null)
sapply(content, function(x) length(x) == 1 && is.na(x))
content
# }
Run the code above in your browser using DataLab