R provides several packages to do data analysis and data manipulation. Over and above the apply family of functions, the most commonly used packages are plyr, reshape, dplyr, and data.table. In this recipe, we will cover data.table, which processes large amounts of data very efficiently, without our having to write detailed procedural code.
Slicing, dicing, and combining data with data tables
Getting ready
Download the files for this chapter and store the auto-mpg.csv, employees.csv, and departments.csv files in your R working directory. Read the data and create factors for cylinders in auto-mpg.csv:
> auto <- read.csv("auto-mpg.csv", stringsAsFactors=FALSE) > auto$cylinders <- factor(auto$cylinders...