title: How to make a general function to create crossfilter.js dimensions
body: <p>I am trying to make a general funtion to create crossfilter.js dimensions and groups. Up to now, I created an specific one depending on the key names (names of the columns) of the data this way (Example with 'Weekday' column):</p>
  
  <pre><code>DataArray= crossfilter(Data);
  dimName = DataArray.dimension(function (d) { return d.Weekday; });
  groupName= dinName.group().reduce(reduceAdd, reduceRemove, reduceInit);
  </code></pre>
  
  <p>This works, obviously, well, but I want to create a general funtion which can create the dimensions, no matter the name of the columns. I had thougth doing this:</p>
  
  <pre><code>var x = Data[0];
  var keyNames= d3.keys(x);
  
  dimName = DataArray.dimension(function (d) { return d.keyNames[0]; });
  ...
  </code></pre>
  
  <p>This doesn't work because 'd.keyNames[0]' is, obviously, wrong.
  How can I pass the keyNames to the return of the function 'd. '??</p>
  
  <p>I hope I explained well.</p>