Q:

r function unzip error 1 in extracting from zip file

Environment:
Windows 7 OS
RStudio Version 0.99.491
I have been programming in R for about 4 months via the Coursera Data Science curriculum, but I have NEVER been successful in using the unzip function.
I've looked at the forums for hours for potential solutions, syntax problems, undefined arguments, etc., but to no avail.  I eventually unzip the contents manually and proceed with the assignment, but I am tired of not knowing why it is not working.
Here are a few examples of the error:
fileName <- "StormData.zip"
unzip(fileName, exdir = mainDir,subDir)

Warning message: In unzip(fileName, exdir = mainDir, subDir) :   error
  1 in extracting from zip file

unzip(fileName)

Warning message: In unzip(fileName) : error 1 in extracting from zip
  file

unzip(fileName, "stormdata.csv") 

Warning message: In unzip(fileName, "stormdata.csv") : error 1 in
  extracting from zip file

unzip(fileName, "stormdata.csv", list = TRUE)

Error in unzip(fileName, "stormdata.csv", list = TRUE) :    zip file
  'StormData.zip' cannot be opened

Any suggestions would be greatly appreciated.  

A:

I too was getting that error 1 message when trying to unzipping a zip file. Glitch in my case was the conflict between working directory and zip file path.
My case was:

My working directory was like "C:/Users/SCOTT/Desktop/Training"
While my zip file was located in "C:/Users/SCOTT/Desktop/Training/house_consumption_data"

When I was trying to execute this:
     unzip("house_data.zip")

Possibly your file is in a different folder.

A:

I was getting the same error.
I changed the path --
from : 
uzp <- "C:\\Users\\Sharvari\\Downloads\\rprog%2Fdata%2Fspecdata"

to 
uzp <- "C:\\Users\\Sharvari\\Downloads\\rprog%2Fdata%2Fspecdata.zip"

and it works fine!
setwd("C:\\Users\\Sharvari\\Downloads")

uzp <- "C:\\Users\\Sharvari\\Downloads\\rprog%2Fdata%2Fspecdata.zip"

unzip(uzp, exdir = "C:\\Users\\Sharvari\\Desktop\\specdata")

