Skip to content

Instantly share code, notes, and snippets.

@mtreg
Last active August 16, 2016 18:54
Show Gist options
  • Save mtreg/8140b86a14d57813c03a64bc03c1ee90 to your computer and use it in GitHub Desktop.
Save mtreg/8140b86a14d57813c03a64bc03c1ee90 to your computer and use it in GitHub Desktop.
Issue Unzipping NYC OpenData Download File in R
#Initiate Download of file, naming it as test.zip
download.file(url='https://data.cityofnewyork.us/api/geospatial/tqmj-j8zm?method=export&format=Original', destfile="test.zip")
#unzip the file using built in functionality
unzip('test.zip')
#Throws error when running on Windows:
#Warning message:
#In unzip("test.zip") : error 1 in extracting from zip file
#Note - this type of procedure works fine using wget in Ubuntu bash, as shown below
download.file(url='https://data.cityofnewyork.us/api/geospatial/tqmj-j8zm?method=export&format=Original', destfile="test.zip", method="wget")
unzip('test.zip')
##Just bash on its own...
#wget 'https://data.cityofnewyork.us/api/geospatial/rjaj-zgq7?method=export&format=Original' -O test.zip
#unzip test.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment