Accepted answer

you can use a temporary variable for the new/current record. your example also looks like you do not want an array (with gaps) but a map. here is how i would load the data:

var authormap = {}

var loadcsv = function(file){
    d3.csv(file, function(error, data) {
        data.foreach(function(d) {
            var a = authormap[d.record_id] = {}
            a.record_id = d.record_id
            a.role      = d.role


Related Query

More Query from same tag