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 this:
R will respond to your commands right from the terminal. Let's have a go:
> 2 + 2 [1] 4
The [1]
tells you that R returned one result, in this case, 4
. The following command shows 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 6.283185 9.424778 12.566371 15.707963 18.849556 [7] 21.991149 25.132741 28.274334 ...
Get Web Application Development with R Using Shiny - Second 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.