title: Pulling JSON Data into R Dataframe
body: <p>I am trying to pull JSON lunar cycle data from the USNO API.  The problem is that there are two arrays of JSON data in what I get back.  I don't see a way to specify what I get back from the Observatory, so I think I need to clean it up in R.  Here is my code:</p>
  
  <pre><code>library(sqldf);
  library(jsonlite);
  
  curr_date &lt;- Sys.Date();
  Q_date &lt;- format.Date(curr_date, "%m/%d/%Y");
  moon_call &lt;- paste0("http://api.usno.navy.mil/moon/phase?date=",Q_date,"&amp;nump=4");
  
  moon_json &lt;- fromJSON(moon_call, simplifyDataFrame =  TRUE);
  
  moon_phases &lt;- do.call("rbind.fill", lapply(moon_json$phasedata, as.data.frame));
  </code></pre>
  
  <p>The data I get back looks like this:</p>
  
  <pre><code>"","error","apiversion","year","month","day","numphases","datechanged","phasedata.phase","phasedata.date","phasedata.time"
  "1",FALSE,"2.1.0",2018,8,29,4,FALSE,"Last Quarter","2018 Sep 03","02:37"
  "2",FALSE,"2.1.0",2018,8,29,4,FALSE,"New Moon","2018 Sep 09","18:01"
  "3",FALSE,"2.1.0",2018,8,29,4,FALSE,"First Quarter","2018 Sep 16","23:15"
  "4",FALSE,"2.1.0",2018,8,29,4,FALSE,"Full Moon","2018 Sep 25","02:52"
  </code></pre>
  
  <p>When convert it to a data frame I get this:</p>
  
  <pre><code>"","X[[i]]"
  "1","Last Quarter"
  "2","New Moon"
  "3","First Quarter"
  "4","Full Moon"
  "5","2018 Sep 03"
  "6","2018 Sep 09"
  "7","2018 Sep 16"
  "8","2018 Sep 25"
  "9","02:37"
  "10","18:01"
  "11","23:15"
  "12","02:52"
  </code></pre>
  
  <p>But what I want is a dataframe with the <code>phasedata.phase/.date/.time</code> columns selected:</p>
  
  <pre><code>"","phase","date","time"
  "1","Last Quarter","2018 Sep 03","02:37"
  "2","New Moon","2018 Sep 09","18:01"
  "3","First Quarter","2018 Sep 16","23:15"
  "4","Full Moon","2018 Sep 25","02:52"
  </code></pre>