Why?

Files of non-trivial sizes are typically gzip files. base::readLines() is suprisingly quick at reading them, but we can go a tad faster. On the other hand, readr::read_lines() decompresses the file before reading it, which is… less than ideal.

{fastgz} contains two simple helpers:

  1. fastgz::read_gz_file() reads an entire file(s) into a single character()
  2. fastgz::read_gz_lines()is the equivalent of base::readLines()/readr::read_lines()

Rather than relying the apply()/purrr::map() families, you can pass multiple file paths to both.

Shout Outs