Chapter 4. Basics of R
R is a powerful tool for all manner of calculations, data manipulation and scientific computations. Before getting to the complex operations possible in R
we must start with the basics. Like most languages R
has its share of mathematical capability, variables, functions and data types.
4.1. Basic Math
Being a statistical programming language, R
can certainly be used to do basic math and that is where we will start.
We begin with the “Hello, World!” of basic math: 1 + 1. In the console there is a right angle bracket (>
) where code should be entered. Simply test R
by running
> 1 + 1[1] 2
If this returns 2, then everything is great; if not, then something is very, very wrong. Assuming it worked, let’s look at some slightly ...
Get R for Everyone: Advanced Analytics and Graphics 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.