O'Reilly logo

R For Dummies, 2nd Edition by Joris Meys, Andrie de Vries

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4

Getting Started with Arithmetic

In This Chapter

arrow Using R as a fancy calculator

arrow Constructing and working with vectors

arrow Vectorizing your calculations

Statistics isn’t called applied mathematics just for the fun of it. Every statistical analysis involves a lot of calculations, and calculation is what R is designed for — the work that R does best.

R goes far beyond employing the classic arithmetic operators. It also contains sets of operators and functions that work on complete vectors at the same time. If you’ve read Chapter 3, you’ve gotten a first glimpse into the power of vectorized functions. In this chapter, you discover the full power of vectorization, using it to speed up calculations and perform complex tasks with very little code.

tip We can’t possibly cover all of R’s mathematical functions in one chapter — or even in one book — so we encourage you to browse the Help files and other sources when you’re done with this chapter. You can find search tips and a list of interesting sources in Chapter 11.

Working with Numbers, Infinity, and Missing Values

In many low-level ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required