Montgomery, Nigel
2019-Feb-25 10:22 UTC
[R] Extracting data from zip file in one directory to a different directory.
Hi there, I've tried several different ways to do the above (see attempts below) and none have been successful. From my internet searches this would appear to be a common problem. Any pointers would be appreciated. Attempt 1: zip_file_loc <- "xx/yy/zipfile.zip" data <- read_csv(unzip(zip_file_loc)) ERROR: error 1 in extracting from zip file Attempt 2: temp <- tempfile() temp <- "xx/yy/zipfile.zip" unzip(temp) ERROR: error 1 in extracting from zip file Regards, Nigel. [[alternative HTML version deleted]]
Jeff Newmiller
2019-Feb-25 18:35 UTC
[R] Extracting data from zip file in one directory to a different directory.
My bet is that the zip file is corrupt. Also, carefully read the documentation for the unzip function... your attempt 1 was not going to work as posed even with a valid file. On February 25, 2019 2:22:10 AM PST, "Montgomery, Nigel" <nigel.montgomery at roche.com> wrote:>Hi there, I've tried several different ways to do the above (see >attempts >below) and none have been successful. From my internet searches this >would >appear to be a common problem. >Any pointers would be appreciated. > >Attempt 1: >zip_file_loc <- "xx/yy/zipfile.zip" >data <- read_csv(unzip(zip_file_loc)) > >ERROR: error 1 in extracting from zip file > >Attempt 2:>temp <- tempfile() >temp <- "xx/yy/zipfile.zip" >unzip(temp) > >ERROR: error 1 in extracting from zip file > >Regards, Nigel. > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.-- Sent from my phone. Please excuse my brevity.