concept delete in category data

appears as: delete
Data Wrangling with JavaScript

This is an excerpt from Manning's book Data Wrangling with JavaScript.

Removing a field from every item in an array isn’t as convenient as filtering out the entire item the way we did with the JavaScript filter function; however, JavaScript does provide a delete operator that does what we need: it removes a field from a JavaScript object (see figure 6.8).

Figure 6.8 Deleting a field from each element in the array has the effect of deleting a “column” from our tabular data.

c06_08.eps

To use the delete operator, we must iterate over our data set and apply it to each record as shown in listing 6.7. Note in transformData that we’re again using the map function to transform the entire array of data. The transformRow function visits each record and uses the delete operator to remove the reef_type field. Run this code, and it will produce the output file surveys-with-no-reef-type.csv. The output data is the same as the input, but with the desired column removed.