Hopefully my first R post whetted your apatite for open source data software. I’m gearing up for more R posts regardless. I thought I’d do a quick post about a couple of useful commands, ‘View’ and ‘fix’. When you first break the shackles of Excel one of the toughest things is not being able to see your data. Try this, fire up R (go download it and install it if you haven’t already) and let’s call up a built-in dataset by typing
You get a big barf load of numbers in your R interpreter window. This is enough to send lots of people running back to Excel as fast as they can say ‘Bill Gates.’ Ok, admittedly that isn’t nice to look at. If you want to view your data in a more visually appealing way you can use the View command (make sure your capitalize the ‘V’).
Now things look more like they do in a spreadsheet. If you’re on a Windows machine this is really works well, you’ll probably have a scrollable window pop up with slider bars and everything. On Mac OS it’s a little more janky. You’ll get an X11 window that you can use your arrow keys to navigate around.
Ok, looking good! What if you’ve loaded in your data, you’re looking it over and you see an error (misspelling maybe)? Do you have to open up your file in Excel, fix it, and re-save it as a csv, and then open it up again in R? No. No you don’t. You can use the fix command (but have care, things can get confusing this way).
volcanoII <- fix(volcano)
will allow you to open up an editable window, make changes by clicking the error with your mouse, and typing in the correction. The changes will be saved in a new data frame called volcanoII (because that's what you typed on the left side of the <- ). Here is the caveat, the data edits aren't saved in the original file, just in R. If you want to save a copy of your edited data frame, you'll have to write out a file from R (use write.table). Alright, hopefully this pushes you a little farther towards dumping your spreadsheet program for data analysis.