title: "last directory" from url as string
body: <p>I would like to return "blah".</p>
  
  <pre><code>url &lt;- "https://www.example.com/apples/pears/blah.csv"
  </code></pre>
  
  <p>I can get blah but I feel like I'm writing more lines of code than I should. Example, to get blah.csv I can do:</p>
  
  <pre><code>url_split &lt;- str_split(url, "/")
  dirname &lt;- url_split[[1]][length(url_split[[1]])]
  </code></pre>
  
  <p>This gives me "blah.csv", where I can do a very similar code block as above to get "blah" by calling str_split again.</p>
  
  <p>Is there a more sophisticated one liner to get the last directory in the url minus ".csv"?</p>