Learn R Programming

nat.utils (version 0.6.1)

is.gzip: Check if a file is a gzip file

Description

Check if a file is a gzip file

Usage

is.gzip(f)

Value

logical indicating whether f is in gzip format (or NA

if the file cannot be accessed)

Arguments

f

Path to file to test

Examples

Run this code
notgzipfile=tempfile()
writeLines('not a gzip', notgzipfile)
is.gzip(notgzipfile)
con=gzfile(gzipfile<-tempfile(),open='wt')
writeLines('This one is gzipped', con)
close(con)
is.gzip(gzipfile)
unlink(c(notgzipfile,gzipfile))

Run the code above in your browser using DataLab