I am trying to create a map visualization using d3. I have gotten the map to work and am trying to add points on the map. Depending on some other data in the CSV file (inspection results) I want certain points to have a different color. I can add the points using this code, but I cannot get the colors to come out correctly (there should be red ones, but all of them are green). I think it is a problem with how I'm trying to get the data out, or just a problem with my JavaScript in general. Any help would be appreciated. Thank you!
function colorr(d) {
  if (d == 0) {
    return "red";
  } else {
    return "green";
  }  
}
var dataset = []
//         load data about food
// https://stackoverflow.com/questions/47821332/plot-points-in-map-d3-javascript
// https://groups.google.com/forum/#!topic/d3-js/AVEa7nPCFAk
// https://stackoverflow.com/questions/10805184/show-data-on-mouseover-of-circle
d3.csv('data6.csv').then( function(data) {
    // don't know if this actually does anything...
    dataset=data.map(function(d) { return [+d["InspectionScore"],+d["Longitude"],+d["Latitude"]];});
    g.selectAll('circle')
      .data(data)
      .enter()
      .append('circle')
      .attr("cx",function(d) { return projection([d.Longitude,d.Latitude])[0]; }).merge(g)
      .attr("cy",function(d) { return projection([d.Longitude,d.Latitude])[1]; }).merge(g)
      .attr("r", .4)
      .attr("fill", d3.color(colorr(   function(d) { return d.InspectionScore }   ) ));
});
 
    