title: R scp and unzip - invalid zip name argument
body: <p>I wonder if anyone can help me - I am trying to download a file using scp and then unzip it (it is a set of 100 files, so they have to be zipped and as well it excludes unz)</p>
  
  <p>Basically first I run</p>
  
  <pre><code>x &lt;- scp(host = "WM.net", path = "/wmdata.zip", user = "w", password =  "wm")
  </code></pre>
  
  <p>it returns a raw object (of course it is a dummy address, you would not get anything, I cannot provide working site you can scp anything)</p>
  
  <pre><code>&gt; class(x)
  [1] "raw"
  </code></pre>
  
  <p>then I try to unzip it</p>
  
  <pre><code>b&lt;-unzip(x)
  Error in unzip(x) : invalid zip name argument
  </code></pre>
  
  <p>I tried to decompress it in memory but with no luck - the output is still raw, not a file list</p>
  
  <pre><code>z&lt;-memDecompress(x, type = "unknown")
  &gt; class(z)
  [1] "raw"
  </code></pre>
  
  <p>Where is my error? What am  doing wrong? I have a vague feeling I need to save x to disc as zip, and then use unzip, but no idea how to save raw compressed value.</p>
  
  <p>EDIT: I tried as well saving as a binary file via</p>
  
  <pre><code>f&lt;-file("file.bin",open="wb") #or f&lt;-file("file.zip",open="wb")
  writeBin(x, f)
  b &lt;- unzip(f) #or b &lt;- unzip("file.bin") or b &lt;- unzip("file.zip")
  </code></pre>
  
  <p>and it produced a file after the first line, but after the second line the file is still empty and the unzip procedure returns the same zip name error</p>
  
  <pre><code>&gt; class(f)
  [1] "file"       "connection"
  &gt; f
  A connection with                      
  description "file.zip"
  class       "file"    
  mode        "wb"      
  text        "binary"  
  opened      "opened"  
  can read    "no"      
  can write   "yes" 
  </code></pre>