title: Calling arrays and data in D3
body: <p>I've been coding in D3 from a while now but there's bits about it that still leave me stumped. I've got some data in a csv file. I'm calling it in the following way</p>
  
  <pre><code>var dataset;     
  d3.tsv("ST_03_data.tsv", function(data) {       
  dataset=data;   
  </code></pre>
  
  <p>and then I do a whole bunch of things like drawing a graph or whatever and it's fine. I'd like to use some, but not all, of the columns of data in a certain way, so what I'd like to do is set them up as a variable. So what I've done, straight away underneath the code above is write</p>
  
  <pre><code>var newvar = (d.data1, d.data3, d.data5)
  </code></pre>
  
  <p>where data1, data3 and data5 are columns of data.  get the error message "Can't find variable d". If if use (data1, data3, data5) instead (that is, dropping the d.) I get an equivalent message. </p>
  
  <p>So what's going wrong? Do I need to build a function? I've sort of tried and that hasn't worked either but  can see how it might be better. All help appreciated. Thanks.</p>
  
  <p>There's a full example here -<a href="http://www.graphitti.org/admin2/files/experiments/click_counter3.html" rel="nofollow">http://www.graphitti.org/admin2/files/experiments/click_counter3.html</a> It looks like it works and it does up to a point but I want to make it easier. At the moment, there are two clicks, and clicking them passes new data in. It does so using variables I have set up in each click, in fact in the attributes for the rectangles. What I want to do is move that variable (called barup at the moment) to the top of the code so I don't need to repeat it. </p>