title: How to directly read an image file from a url address in R
body: <p>I'm trying to directly load a .jpeg image from a url address. I'm wondering if there is a basic way to do this by using a <code>url</code> connection.</p>
  
  <p>I first tried:</p>
  
  <pre><code>require(biOps)
  con &lt;- url("http://upload.wikimedia.org/wikipedia/commons/9/95/Apollonian_spheres.jpg")
  pic &lt;- readJpeg(con)
  #Error in readJpeg(con) : Cannot open file.
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/12888120/loading-png-files-directly-from-url">This other question</a> seems to be along the same lines, but for a .png file. I tried to adapt to a .jpeg, but also got an error.</p>
  
  <pre><code>require(biOps)
  require(RCurl)
  myurl &lt;- "http://upload.wikimedia.org/wikipedia/commons/9/95/Apollonian_spheres.jpg"
  pic &lt;-  readJpeg(getURLContent(myurl))
  #Error in readJpeg(getURLContent(myurl)) : Cannot open file.
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>