You are previewing R in Action.

R in Action

Cover of R in Action by Robert Kabacoff Published by Manning Publications

Chapter 4. Basic data management


This chapter covers
  • Manipulating dates and missing values
  • Understanding data type conversions
  • Creating and recoding variables
  • Sorting, merging, and subsetting datasets
  • Selecting and dropping variables


In chapter 2, we covered a variety of methods for importing data into R. Unfortunately, getting our data in the rectangular arrangement of a matrix or data frame is the first step in preparing it for analysis. To paraphrase Captain Kirk in the Star Trek episode “A Taste of Armageddon” (and proving my geekiness once and for all): “Data is a messy business—a very, very messy business.” In my own work, as much as 60 percent of the time I spend on data analysis is focused on preparing the data for analysis. ...

The best content for your career. Discover unlimited learning on demand for around $1/day.