title: Run BLS API large dataframe with results per query limit and save as dataframe in R
body: <p>I am trying to pull a large amount of data (~500K individual series IDs) using the BLS API and store the output as a dataframe.</p>
  <p>I've run into a two problems:</p>
  <ol>
  <li>The BLS API only allows 50 results/query and 2.5K queries per day</li>
  <li>Saving the output as a compiled dataframe</li>
  </ol>
  <p>I created a dataframe with just one column &quot;Series ID&quot; which is the information the BLS API needs to spit back out the data on that particular ID. To bypass the results/query limit, I've tried splitting a data frame of all 500K series IDs into groups of 250 (to stay under the queries per day limit) and using a function to run the bls_api code through each group separately. I believe this may have worked, but I'm unable to see the output. To try and save the output in a dataframe, I created a blank dataframe and attempted to rbind the BLS Data function output with the blank dataframe.</p>
  <h1>Create a blank dataframe to store BLS output in</h1>
  <p><code>output &lt;- data.frame();</code></p>
  <h1>Run BLS API code on segments of 250 lines of series IDs</h1>
  <pre><code>unlist(lapply(split(df$`Series ID`, rep(1:250)),
  function(Data)
  {bls_data &lt;- bls_api(Data,startyear=2016, endyear= 2019, Sys.getenv(&quot;BLS_KEY&quot;));
  output &lt;- rbind(output,bls_data)}))
  </code></pre>
  <p>While I see the output of the <code>BLS_API (ie. &quot;REQUEST_SUCCEEDED&quot;)</code> in the console, the output does not save as the dataframe &quot;output&quot; (the dataframe is still blank).</p>
  <p>I'm new to functions so any advice is valuable!</p>