I have about 300 arrays that each have 100 arrays of x and y values. I want to get an array of 100 mean for y values of the 300 arrays. What is the best way to do this? I believe I should use some sort of reduce but am a little lost. Here is what I have so far:
let yval = cohort.map((d, i) => {
let bin = d3.nest()
.key(function(d) {
return i;
})
.rollup(function(d) {
return d;
})
.entries(d);
return bin;
});
console.log(yval);
'cohort' is an array of objects. I want to isolate the 'bins' array in each cohort object. Each of these are 117 elements long. For each bins[i], I want to get the mean of [i] from all of the bins. I want to basically turn the array of 300 arrays of 117 into one array of 117 means. Any help would be greatly appreciated!