I am downloading a 78MB zip file from the UN FAO, which contains a 2.66GB csv. I am able to unzip the the downloaded file from a folder using winzip, but have been unable to unzip the file using unzip()
in R:
Warning - 78MB download!
url <- "http://fenixservices.fao.org/faostat/static/bulkdownloads/FoodBalanceSheets_E_All_Data_(Normalized).zip"
path <- file.path(getwd(),"/zipped_data.zip")
download.file(url, path, mode = "wb")
unzipped_data <- unzip(path)
This results in a warning and a failure to unzip the file:
Warning message
In unzip(path) : zip file is corrupt
In the ?unzip
documentation I see
"It does have some support for bzip2 compression and > 2GB zip files (but not >= 4GB files pre-compression contained in a zip file: like many builds of unzip it may truncate these, in R's case with a warning if possible)"
This makes me believe that unzip()
should handle my file, but this same process has successfully downloaded, unzipped, and read multiple other smaller tables from the FAOstat. Is there a chance that the size of my csv is the source of this error? If so, what is the workaround?
shell
function from R. if you wrap it into a functionunzip2
there won't be much difference – Communicationsystem
but I haven't seen an example. Could you provide one, or point me in the right direction? Thanks for the help! – Dockery