Chapter 3 R data structures

R project

This chapter continues our basic introduction to R (R Core Team, 2022b).

More specifically, this chapter introduces additional data structures (beyond vectors):

Important concepts and contents include:

  • defining different data structures (from vectors to matrices, data frames, and lists);
  • accessing and changing data structures by indexing or subsetting.


Recommended readings for this chapter include:


Before reading, please take some time to reflect upon the following questions:

i2ds: Preflexions

  • In which forms can variables of different types be stored?

  • Which differences exist between a (linear) vector and a (rectangular) matrix or table?

  • Which properties of a vector are too limited for representing a real-world data?

Note: This chapter is still fragmentary. See Chapter 1: Basic R concepts and commands of the ds4psy book (Neth, 2022a) for a more complete account.


Neth, H. (2022a). Data science for psychologists. Social Psychology; Decision Sciences, University of Konstanz.
R Core Team. (2022b). R base: A language and environment for statistical computing. R Foundation for Statistical Computing.