# R, a programming language and environment for statistical analysis

27 mayo, 2021

R is a programming language and environment for statistical and graphical analysis. His story was already told in genbetadev and I don’t want to be repetitive but to summarize, we could say that it is a free dialect of the S language, developed by Robert Gentleman and Ross Ihaka from the Department of Statistics at the University of Auckland in 1993.

## How can R help me?

• R, being statistics-oriented, provides a wide range of tools.
• Among other characteristics of R, we can name its graphic capacity, which allows generating high-quality graphics, just by using the graphing functions.
• R can also be used as a numerical calculation tool and at the same time be useful for data mining.

As I said before, R is a powerful environment and language in which we can process data and graph. But I do not want to stop at the environment but I want to review the language.

Like S, it is a programming language, which allows it to extend its own functions. The vast majority of R functions were written in R but for performance reasons there are functions written in lower-level languages ​​such as C or Fortran.

R is a interpreted language, the user usually accesses by command lines or console. Let’s see some examples:

If we want to make a Hello world we can do it as follows:

```> print("Hola Mundo")
> [1] "Hola Mundo"
```

```> 2 + 3
> [1] 5
```

But what makes R so powerful? Wait, we just started. Let’s look at R doing what he does best, analyzing data.

We are going to create a collection:

```> x

> y  y
> [1] 1 4 9 16 25 36

Now we are going to calculate the half, the variance and let's graph!
> mean(y)
> [1] 15.16667
> var(y)
> [1] 178.9667
> plot (y)

As we can see, R is a very powerful language and environment, oriented to the study of statistical data.

In addition, R can be integrated with different databases and there are libraries that facilitate its use from interpreted programming languages ​​such as Perl, Python and Ruby.  And of course there are projects that allow you to use R from Java or .net.