You could do it like this:
zipF<-file.choose() # lets you choose a file and save its file path in R (at least for windows)
outDir<-"C:\\Users\\Name\\Documents\\unzipfolder" # Define the folder where the zip file should be unzipped to
unzip(zipF,exdir=outDir) # unzip your file
Well you could also define both paths in R the classical way:
Assuming your zip file is named file.zip
zipF<- "C:\\path\\to\\my\\zipfile\\file.zip"
outDir<-"C:\\Users\\Name\\Documents\\unzipfolder"
unzip(zipF,exdir=outDir)
exdir
defines the directory to extract files to. It will be created if not already available.
If you don't set exdir
, unzip
will just unzip it to your current working directory.