Chapter 2

Starting Out: Becoming Familiar with R

What you will learn in this chapter:

  • How to use R for simple math
  • How to store results of calculations for future use
  • How to create data objects from the keyboard, clipboard, or external data files
  • How to see the objects that are ready for use
  • How to look at the different types of data objects
  • How to make different types of data objects
  • How to save your work
  • How to use previous commands in the history

So far you have learned how to obtain and install R, and how to bring up elements of the help system. As you have seen, R is a language and the majority of tasks require you to type commands directly into the input window. Like any language you need to learn a vocabulary of terms as well as the grammar that joins the words and makes sense of them. In this chapter you learn some of the basics that underpin the R language. You begin by using R as a simple calculator. Then you learn how to store the results of calculations for future use. In most cases, you will want to create and use complex data items, and you learn about the different kinds of data objects that R recognizes.

Some Simple Math

R can be used like a calculator and indeed one of its principal uses is to undertake complex mathematical and statistical calculations. R can perform simple calculations as well as more complex ones. This section deals with some of R’s commonly used mathematical functions. Learning how to carry out some of these simple operations will give you ...

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.