Chapter 15 Uses of R
Now’s a good time to change gears for a little. While we’ve done a lot already, it may seem like R
is just good at helping with homework, speeding up calculations involving data. But it’s easy to make use of R
when you’re instructed on how to do it and see specific use cases.
At its core, R
is great at computing statistics and making plots. After all, it was built by statisticians, for statisticians. But like any language, R
has grown to be great for so much more than what you’ve seen. It has the power to manipulate entire datasets, create documents (like this entire book, your homework assignments, etc.), and even build websites and applications. We’ll cover how to do some of this in this section of the book.
If you want to think of yourself as an R
doctor, all of the patients (datasets) you’ve seen so far have come in healthy. You’ve learned how to find the information needed for their charts, and you should be very comfortable with how a healthy check-up should go. But what do you do when a patient comes in sick? They’ve got something wrong with them, and it’s your job to figure out what it is and how to fix it. This diagnosing process, as well as what we do to cure the patient, is known as data cleaning.
What we mean is that, in practice, data sets that we’d like to analyze are rarely clean when we first get them. Values can be of the wrong type, be missing altogether, or not be in the formats we want them to be. No worries though! We’ll see how to use R
to do all of this for us!
Ready? Let’s ride.