O'Reilly logo

Data Manipulation with R - Second Edition by Jaynal Abedin, Kishor Kumar Das

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

Writing commands in R

The R programming language is basically command-line (interpreter-type) programming. We can perform any type of mathematical and statistical calculation, including data management analysis and graphics in the command line. The R command window is known as the R console, where the command and the results are produced upon execution of a given command.

Here is a very basic example of using the R console:

> (44/55)*100
[1] 80
> log(25)
[1] 3.218876
> log10(25)
[1] 1.39794
> exp(0.23)
[1] 1.2586
> 453/365.25
[1] 1.240246
> 1-5*0.2
[1] 0
> 1-0.2-0.2-0.2-0.2-0.2 # An interesting calculation 
[1] 5.551115e-17

Using the R console, we can perform any type of calculation, but we always need to preserve the code to reproduce the result ...

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