Check if a file is a gzip file
is.gzip(f)
logical indicating whether f
is in gzip format (or NA
if the file cannot be accessed)
notgzipfile=tempfile()
writeLines('not a gzip', notgzipfile)
is.gzip(notgzipfile)
#> [1] FALSE
con=gzfile(gzipfile<-tempfile(),open='wt')
writeLines('This one is gzipped', con)
close(con)
is.gzip(gzipfile)
#> [1] TRUE
unlink(c(notgzipfile,gzipfile))