score:1

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.name      = d.name
            a.role      = d.role
        });
    });
}

loadcsv("file1.csv")
loadcsv("file2.csv")

Related Query

More Query from same tag