What is R Programming Language?

5 min
What is R Programming Language?

There are many programming languages named with the one letter. For example, we can include C or D languages but have you ever heard about R language? Let’s see what it especially is.

R is a programming language for statistical computing, for example it includes also machine learning algorithms or linear regression to create graphical charts in a simple way. Most of the R libraries are developed in R, but for strong calculations, C++ codes are preferred.

Data analysis with use of this language is computed in a few steps: programming, transforming, discovering, modeling and show the results. The R language is widely used not only by scientists, but many large companies also use it for reach their purposes, especially including Google, Facebook or Uber.

Let’s produce simple chart with R


# Define 3 vectors
# Lions are marked in blue, tigers are marked in red, yauars are marked in green
lions <- c(1, 3, 6, 4, 9)
tigers <- c(2, 5, 4, 5, 12)
yaguars <- c(3, 1, 7, 8, 12)

# Graph lions using a y axis that ranges from 0 to 12
plot(lions, type="o", col="blue", ylim=c(0,12))

# Graph tigers with red dashed line and square points
lines(tigers, type="o", pch=22, lty=2, col="red")

# Graph yaguars with green dashed line and square points
lines(yaguars, type="o", pch=22, lty=2, col="green")

# Create a title with a red, bold/italic font
title(main="Cats", col.main="red", font.main=4)

The above code should generate the following chart:

Chart generated in R.


As you can see, with R we can produce complex graphs with less code. For this example I used the RStudio editor with the ggplot2 library previously installed.

Post a Comment

Your email address will not be published. Required fields are marked *