Chapter 3
Digging Deeper Into R
IN THIS CHAPTER
Unpacking packages
Formulating formulas
Reading and writing files
It’s time to delve more deeply into R. In this chapter, I tell you how to unlock R features that reside in packages. I also show you how to create R formulas that perform statistical analyses and how R imports and exports data.
Packages
A package is a collection of functions and data that augments R. If you’re an aspiring data scientist and you’re looking for data to work with, you’ll find data frames galore in R packages. If you’re looking for a specialized statistical function that’s not in the basic R installation, you can probably find it in a package.
R stores packages in a directory called the library. How do you get a package into the library? Click the Packages tab in the Files, Plots, Packages, and Help pane. In the upcoming example, I use the well-known MASS package, which contains over 150 data frames from a variety of fields.
If you want to see what’s in the MASS package, click on MASS in the Packages tab. (It’s in the System Library section of this tab.) That opens a page on the Help tab, which appears in Figure 3-1.
Get Statistical Analysis with R Essentials For Dummies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.