Frequently we find that our data is not quite in the form we want it to be. Maybe we need just the means and SEs of some treatments, or we want to calculate a summary variable froms several others. One of the strengths of R is the ease with which data can be manipulated. In fact, I sometimes refer to this chapter as "things I used to do in Excel but are easier in R". Here we'll introduce several useful tools for manipulating data, using Chapter 9 of Essential R.
- Extract summary statistics for subsets or groups of data defined by factors
- Change factor levels
- Calculate new variables from existing variables
- Stack and unstack data
- Merge two data frames