title: D3: how to make this variable universal?
body: <p>I'm trying to reproduce Mike Bostock's Object Constancy example. 
  <a href="http://bost.ocks.org/mike/constancy/" rel="nofollow noreferrer">http://bost.ocks.org/mike/constancy/</a></p>
  
  <p>I read in my data, clean it, nest it, then call redraw()</p>
  
  <p>When I call redraw(), I get error "Can't find variable nested_data"
  This error makes sense to me.  It seems nested_data is indeed a local variable.</p>
  
  <p>OTOH, my code throws the error on line 103. I would have expected it at 98.</p>
  
  <p>Gist here: <a href="https://gist.github.com/greencracker/d767c9065c2a645868c4" rel="nofollow noreferrer">https://gist.github.com/greencracker/d767c9065c2a645868c4</a></p>
  
  <p>The question is, how come Bostock's example works?  Seems like it shouldn't.</p>
  
  <p>How can I fix mine: </p>
  
  <p><img src="https://i.stack.imgur.com/m7T4h.jpg" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/eBrRa.jpg" alt="enter image description here"></p>
  
  <p>For reference, Bostock's. Annotations by me. 
  <img src="https://i.stack.imgur.com/fU1dT.jpg" alt="enter image description here"></p>