Programming Languages Section

R

Card image
Post by Amina Delali, September 18th,2021

Some Facts

R is a language used for statistical  programming, graphics and machine learning. Using the language, it is easy to produce well-designed plots ready for publication. It is a free open source data science  language, with new features developed continuously and released immediately. 

It can be used in many different operating systems since it is machine-independent. It supports various data types, can use parallel and distributed computing, and it is compatible with other programming languages such as C , C++ and Fortran. It is also an interpreted language mainly used for descriptive statistics and exploratory data analysis.

 R is a language used by many companies such as Facebook , Google , and Bing, and in different sectors as Finance, Social Media and E-Commerce.



How to install it

  • on Windows:

    To install the R language on Windows 10, just follow these steps

    1. go to this R project page and click on “Download R for Windows''. You will be directed to another page.
    2. from the new page, click on “base” or on the “install R for the first time” link. You will be again directed to another page.
    3. from this last page, click on the highlighted link “Download R x.x.x for Windows” to download the corresponding installer. For example, at the time of writing this article, the highlighted link is “Download R 4.1.1 for Windows”. 
    4. run the downloaded installer and follow the displayed instructions.

    For more details you can visit the following tutorial page:

  • on ubuntu :
    • To install the R language on Ubuntu, just open the terminal and run the following commands:

      sudo apt update
      sudo apt -y upgrade
      sudo apt -y install r-base

    • To check the installation, run the following command: Rscript --version

    For more details about the installation, you can check this tutorial page (the same as the one for the installation of R on Windows 10).

In the video below, the details of the installation of the Rlanguage on Ubuntu.

The Hello World Example

To run your code on Ubuntu, simply follow these steps:

  1. from the Home folder, create the “hello.r” file
  2. type in and save the following code:
    print ("Hello World!")
  3. to run the script, open the terminal, and run the following command: Rscript hello.r


Something to say ?

If you want to add something about the R language or about this post, please feel free to do it by commenting below 🙂 .