The R console

Windows and Mac OS X users can run the R application to launch the R console. Linux and Mac OS X users can also run the R console straight from the Terminal by typing R.

In either case, the R console itself will look something like the following screenshot:

R will respond to your commands right from the Terminal. Let's have a go. Run the following command in the R console:

> 2 + 2
[1] 4

The [1] phrase tells you that R returned one result, in this case, 4. The following command shows you how to print Hello world:

> print("Hello world!")
[1] "Hello world!"

The following command shows the multiples of pi:

> 1:10 * pi
[1] 3.141593 ...

Get Web Application Development with R Using Shiny - Third Edition 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.