3.4 Summary

ds4psy: (3) Transforming data

This chapter introduced basic ways of data transformation using the tools provided by the dplyr package.

After working through this chapter, you should be able to use dplyr to:

  1. arrange cases (rows) based on one or more criteria;
  2. select cases (rows) and variables (columns) from a data table;
  3. change and create new variables;
  4. compute summary statistics over variables and grouped values;
  5. combine multiple commands into pipes to answer questions and create new data tables.

This chapter only covered some essential tools provided by the dplyr package. Take a look at the RStudio cheatsheet on data transformation to check which commands you are now familiar with and which others you can still discover in the future:

Data transformation with dplyr from RStudio cheatsheets.

Figure 3.7: Data transformation with dplyr from RStudio cheatsheets.

We will encounter more types of data transformation in Chapter 7 on Tidying data and additional dplyr functions in Chapter 8 on Joining data.

Let’s test our knowledge and skills by completing the following exercises.