title: Parsing URL strings in R
body: <p>Let's say I have a series of URL strings that I've imported into R.</p>
  
  <pre><code>url = c("http://www.mdd.com/food/pizza/index.html", "http://www.mdd.com/build-your-own/index.html",
          "http://www.mdd.com/special-deals.html", "http://www.mdd.com/find-a-location.html")
  </code></pre>
  
  <p>I want to parse through these url's to identify what page they are. I want to be able to map url[3] to special deals page. For this example, let's say I have the following 'types' of pages.</p>
  
  <pre><code>xtype = c("deals","find")
  dtype = c("ingrediants","calories","chef")
  </code></pre>
  
  <p>Given these types, I want to take the url variable and map them together.</p>
  
  <p>So I should end up with:</p>
  
  <pre><code>&gt; df
                                             url  site
  1     http://www.mdd.com/food/pizza/index.html dtype
  2 http://www.mdd.com/build-your-own/index.html dtype
  3        http://www.mdd.com/special-deals.html xtype
  4      http://www.mdd.com/find-a-location.html xtype
  </code></pre>
  
  <p>I began looking into this project by thinking that I'd need to use strsplit to strip apart each url. However, the following doesn't work to split apart the url. Splitting apart the url's would allow me to put together some if-else statements for performing this task. Efficient? No, but as long as it get's the job done.</p>
  
  <pre><code>Words = strsplit(as.character(url), " ")[[1]]
  Words
  </code></pre>
  
  <p>Here are my main questions:</p>
  
  <pre><code>1. Is there a package to do URL parsing in R?
  2. How can I go about identifying the page which is viewed from a large url string?
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>What I'm asking is this: How can I figure out the 'specific page' from a url string. So if I have "<a href="http://www.mdd.com/build-your-own/index.html" rel="nofollow">http://www.mdd.com/build-your-own/index.html</a>" I want to know how I can extract just build-your-own. </p>