dataJoined = data.map(d => {
const matchingRow = legalityData.find(row => row.country === d.country);
const matchingPop = popsize4.find(row => row.country === d.country);
console.log(matchingRow)
return {
...d,
when_legal: matchingRow ? +matchingRow.year : null,
pop_size: matchingPop ? +matchingPop[d.year] : null,
}
});