The source data is structured and complete, but there’s a problem: there’s a “%” sign on the end of all the readings. We won’t be able to do any sort of math on this or use it as a source for a Fusion Tables choropleth map unless we can remove those first.
There are a few different ways to do this, but I prefer using Google Refine (soon to be Open Refine). It’s powerful, versatile, free, and open-source. All the good things. Plus, you can point it directly to the URL of your data, like so:
It also happily opens files from your computer as well.
Click “Next” and then in the preview pane, check “Ignore first…lines”:
Change the value from 0 to 1, and click “Update Preview” so that the preview changes from:
Be sure to make a note of the source and contact information, and keep that original URL handy.
Now we’re ready to tackle those “%” signs. Click the down arrow next to the header of the PctOnFoodStamps column, and under “Edit column” choose “Add column based on this column..”:
In the resulting popup, enter a new column name, and in the expression box, enter
chomp(value, "%"). The preview pane should show just the number, sans percent sign, in the right-hand column:
Copy the formula to your clipboard, then click “OK”.
Your file will now have two copies of the same data; one with the “%”, one without. You’ll want to delete the original column, by once again clicking the down arrow next to the header of the PctOnFoodStamps column, and under “Edit column” selecting “Remove this column”:
You can then repeat this process with the remaining columns, pasting in the formula from your clipboard each time. Once you’ve finished, you can export your project in your format of choice (I often prefer tab-separated) and continue with your analysis or visualization.
chompfunction isn’t limited to removing just percent signs, of course. You can have it chomp any string from the end of your data. Use it to remove whole words, phrases, or sentences, or even extra zeroes.