title: How to write URL as filename?
body: <p>I would like to use the URL address as filename instead of "i". Thought it was piece of cake with just <code>links[i,0]</code> instead of "i" in the write function, but it does not seem to work.</p>
  
  <pre><code>library(RCurl) 
  library(foreach) 
  library(foreign)
  
  links &lt;- read.table("CSV FILE WITH N LINKS", header = T, quote = "\"")
  
  outpath &lt;- "RANDOM FOLDER"
  
  foreach(i = 1:nrow(links)) %do% {
  text &lt;- getURL(links[i,])  print(i) 
  write(as.character(text), file = paste(outpath, "/", i, ".txt", sep = ""))}
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>10: In file(file, ifelse(append, "a", "w")) :
    cannot open file '/Users/kasper2304/Desktop/Lego test/Star Wars output/http://news.lugnet.com/starwars/?n=10.txt': No such file or directory
  </code></pre>