I have collected a dataset of meteorite landings and organized the data into four keys based on type:
var dataByType = d3.nest()
.key(function(d) {
return d.rectype;
})
.entries(dataset); // original dataset
You can see the resulting structure here: data
https://i.sstatic.net/aiYHt.png
Now, my goal is to create new arrays by filtering the nested data. I want each filtered array to only include objects within a specified mass range.
I attempted the following:
// Filter small meteorites
var lightWeight = dataByType.forEach(function(d){
d.values.filter(function (object) {
var mass = object.mass;
return mass <= 100;
});
});
However, this code snippet returns "undefined".
Nesting the data has proven challenging for me. Can you help me identify where I went wrong?
Thank you in advance