A question I meant to ask for a very long time: I have several functions that temporarily open files using file(..., open="rb"). I'd like to support gzip'ed files also and noticed that gzfile(..., open="rb") handles also non-compressed files, cf. help("gzfile"):
For 'gzfile' the description is the path to a file compressed by 'gzip': it can also open for reading uncompressed files and those compressed by 'bzip2', 'xz' or 'lzma'. >From simple benchmarking I cannot measure any overhead from using gzfile(). I assume the only overhead would come from inspecting the first few bytes in the file. Also, there is no risk that my non-compressed files have gzip header (by chance), so that is not a concern. Does anyone see a reason for not just using gzfile(..., open="rb") everywhere I use file(..., open="rb") today? /Henrik ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel