title: Scraping multiple directories from the same website in R
body: <p>I am trying to I am trying to make a database <a href="http://mikelee.co/posts/milb-scraper-with-rvest/" rel="nofollow noreferrer">similar to this one</a>, but with a different table.</p>
  
  <p>I have a list of playerids (in the mbp_example.csv file) and I am looping through each playerids website and pulling the table "2016 Player Batting Splits" (<a href="http://www.baseball-reference.com/register/player.cgi?id=confor001mic&amp;type=bgl&amp;year=2016" rel="nofollow noreferrer">example here</a>). However, I keep getting multiple error types.</p>
  
  <p>I have listed my code below:</p>
  
  <pre><code>c('rvest','dplyr') -&gt; packages #installs packages
  lapply(packages, library, character.only = T)
  
  id &lt;- read.csv("mbp.csv")
  url &lt;- "http://www.baseball-reference.com/register/player.cgi?id="
  ids=c(id)
  stats_table &lt;- '#batting_splits_milb.sortable.stats_table'
  stats_id &lt;- paste0(stats_table,' a')
  minors_splits &lt;- data.frame()
  for (ids in ids) {
  html &lt;- paste(url,ids,"&amp;type=bgl&amp;year=2016",sep="")
  read_html(html) %&gt;%
  html_nodes(stats_table) %&gt;%
  html_table(header = T) %&gt;%
  data.frame() %&gt;%
  tbl_df() -&gt; df
  df &lt;- df[1:nrow(df),]
  df$ids &lt;- c(ids)
  minors_splits &lt;- rbind(minors_splits,df)
  }
  </code></pre>
  
  <p>This gives me the following error(s):</p>
  
  <pre><code>Error in doc_parse_file(con, encoding = encoding, as_html = as_html, options = options) : 
    expecting a single value
  </code></pre>
  
  <p>or </p>
  
  <pre><code>Error in rbind(deparse.level, ...) : 
    numbers of columns of arguments do not match
  </code></pre>