3 Making new data values

This chapter covers

  • Performing operations between two or more data values
  • Comparing values of the same or different type
  • How R changes the data type as it needs to

You have your data values, but there’s a good chance you’ll want to do something with them, like add or multiply. It’s time to go back to basics and see how R deals with combining data. Thankfully, R is a readable language for things like this, and with any luck you’ll be able to code up what you’re trying to do with the operators you expect. Follow along with this chapter in the Console and try some values yourself to see if you get the results you expect.

3.1 Basic mathematics

The simplest thing you might want to do to two values is add them. No surprises ...

Get Beyond Spreadsheets with R 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.