0

I am a totally new user of R, now I need to download and unzip http://gdac.broadinstitute.org/runs/code/firehose_get_latest.zip in my R, I have tried the code:

temp <- tempfile()
> download.file("http://gdac.broadinstitute.org/runs/code/firehose_get_latest.zip",temp)

however, when I tried the following code:

data <- read.table(unz(temp, "firehose_get_latest"))

it showed that

Error in open.connection(file, "rt") : cannot open the connection
In addition: Warning message:
In open.connection(file, "rt") :
  cannot locate file 'firehose_get_latest' in zip file '/tmp/RtmpotKFGQ/file11ff4f04fe46'

So what should I do to then?
ANY HELP ARE APPRECIATED!

alistaire
  • 42,459
  • 4
  • 77
  • 117
yolanda
  • 1
  • 1
  • please google, this is surely a duplicate – MichaelChirico May 02 '16 at 18:48
  • Assuming that `temp` contains the full path to your file, did you try `data <- read.table(unz(temp, "firehose_get_latest.zip"))`? – shrgm May 02 '16 at 18:51
  • You don't need a temp file for `unz()`. The first argument is the zip file name. Then the `filename` argument in `unz()` needs to be the exact file name from within the zip file that you want to read (i.e. with extension if it has one). You probably need to add `.csv` or `.txt` or whatever extension is used for that file. It's all documented in `help(unz)` – Rich Scriven May 02 '16 at 18:52
  • Also if you are on Windows you need `mode="wb"`. http://stackoverflow.com/questions/23899525/using-r-to-download-zipped-data-file-extract-and-import-csv – user20650 May 02 '16 at 18:56
  • Also, you can see what's in the zip (all the file names) without unzipping it with `unzip("firehose_get_latest.zip", list = TRUE)` – Rich Scriven May 02 '16 at 18:58
  • 1
    Thank you very much!! My problem is that I did not add the pathway to the file name ! Really appreciate for your kind help!~ – yolanda May 02 '16 at 20:03

0 Answers0