Chapter 3

Starting Out: Working With Objects

What you will learn in this chapter:

  • How to manipulate data objects
  • How to select and display parts of data objects
  • How to sort and rearrange data objects
  • How to construct data objects
  • How to determine what form a data object is
  • How to convert a data object from one form to another

Data objects are the fundamental items that you work with in R. Carrying out analyses on your data and making sense of the results are the primary reasons you are using R. In this chapter you learn more about data objects and how to work with them. You learn how to recognize the different forms of data objects that R uses, and how to convert one form into another. You also learn how to sort and rearrange data, and how to extract parts of data that match criteria that you set. All of these tasks are essential in the path towards understanding R as well as being able to understand your data and analyze it effectively.

Manipulating Objects

Now that you have a few data objects to deal with it is time to think about examining these objects and getting to grips with the actual data they contain. When you collect data the first step is to get the data into R. After this you will want to look at your data, and perform summary statistics and other analyses on them. Although many analytical operations can be conducted on the data “as is,” there will be many occasions when you will want to manipulate the data you have; you may want to reorder the data into a new and ...

Get Beginning R: The Statistical Programming Language now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.