0
unzip("fasta.gz")

Warning message: In unzip("fasta.gz") : error 1 in extracting from zip file

I am trying to unzip a zip file but it is not working what am I doing wrong?

Martin Gal
  • 16,640
  • 5
  • 21
  • 39
ksci
  • 7
  • 4

2 Answers2

1

Would something like this work?

# Input:
#   file_name: the name of the file to unzip
#
# Output:
#   file_name: the name of the unzipped file
#
# Usage:
#   file_name <- unzip_file(file_name)
#
unzip_file <- function(file_name) {
  file_name <- gzfile(file_name)
  file_name <- unzip(file_name)
  file_name <- gzfile(file_name)
  file_name
}
PCDSandwichMan
  • 1,964
  • 1
  • 12
  • 23
0

No, you are trying to decompress a gzip file, not a zip file. Those are two different things. unzip is for zip files. Use gunzip() or gzfile() for gzip files.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158
  • What is the difference? – ksci Apr 09 '22 at 18:46
  • They are two completely different file formats with different purposes. https://stackoverflow.com/questions/20762094/how-are-zlib-gzip-and-zip-related-what-do-they-have-in-common-and-how-are-they – Mark Adler Apr 09 '22 at 22:48