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