I am currently doing this to only extract csv files from a zip file and wondered if there is a more direct way of doing this? Would have been nice if which= could be a pattern (regular expression or glob).
import_csvs_from_zip <- function(x, ...) {
filenames <- rio:::.list_archive(x)
csv_names <- grep("\\.csv$", filenames, value = TRUE)
import_list(x, which = csv_names, ...)
}
import_csvs_from_zip("myzip.zip", rbind = TRUE)