Advance

Tutorial Install R on Debian 10

Tutorial install R on Debian 10
1
(1)

R is an open-source programming language. It is also used for statistical computing and graphical representation. Having a free environment, users install this tool for some statistical software, performing data analysis, and visualization. In this article, you will learn the Tutorial Install R on Debian 10. Continue this guide to generate packages for your specific areas of study. Before all, you need to have your own Linux VPS initially. Find a suitable package depend on your needs in Eldernode and touch the difference.

To let this tutorial work better, please consider the below Prerequisites:

At least 1 GB of RAM

A non-root user with sudo privileges or log in as root

To set up, follow our Initial Setup with Debian 10.

Install R on Debian 10

Additionally, R is supported by the R Foundation for Statistical Computing and mainly used by statisticians and data miners for developing statistical software and performing data analysis. Stay with us to show you how to install R on Debian 10 and add packages.

Recommended Article: How to use find Command to search Directories more efficiently

How to install R Dependencies on Debian 10

You will not find the latest stable version always available. Because R is a fast-moving project. To solve this issue, you can add the external repository maintained by CRAN. You will handle it by installing some dependencies for the Debian 10 cloud image. Also, you should install dirmngr to be able to add the external repository and perform network operations that manage and download certificates.

sudo apt install dirmngr --install-recommends

You can use the add-apt-repository command to add a PPA reference. But anytime you did not find this command, add this utility to your system by installing software-properties-common

sudo apt install software-properties-common

After that, you can make sure if you have HTTPS support for secure protocols or not. To do this, install the following tool.

sudo apt install apt-transport-https

Learn install R on Debian 10

You can install from the CRAN repositories, to receive the most recent version of R

Run the command below to add the relevant GPG key.

sudo apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF'
Output
Executing: /tmp/apt-key-gpghome.y6W4E0Gtfp/gpg.1.sh --keyserver keys.gnupg.net --recv-key E19F5F87128899B192B1A2C2AD5F960A256A04AF  gpg: key AD5F960A256A04AF: 4 signatures not checked due to missing keys  gpg: key AD5F960A256A04AF: public key "Johannes Ranke (Wissenschaftlicher Berater) <[email protected]>" imported  gpg: Total number processed: 1  gpg:               imported: 1

Add the repository after having the trusted key.

sudo add-apt-repository 'deb http://cloud.r-project.org/bin/linux/debian buster-cran35/'

Next, you will need to run an update after this in order to include package manifests from the new repository.

sudo apt update

When the running is completed and you returned to your prompt, begin installing R using the command below.

sudo apt install r-base

Press y to continue when you are prompted to confirm the installation.

Please Note: As you see, you are installing an example package for every user on the system. So you should start R as root so that the libraries will be available to all users automatically. Although you can setup a personal library for your user by running the R command without sudo:

sudo -i R
Output
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"  Copyright (C) 2018 The R Foundation for Statistical Computing  Platform: x86_64-pc-linux-gnu (64-bit)    R is free software and comes with ABSOLUTELY NO WARRANTY.  You are welcome to redistribute it under certain conditions.  Type 'license()' or 'licence()' for distribution details.      Natural language support but running in an English locale    R is a collaborative project with many contributors.  Type 'contributors()' for more information and  'citation()' on how to cite R or R packages in publications.    Type 'demo()' for some demos, 'help()' for on-line help, or  'help.start()' for an HTML browser interface to help.  Type 'q()' to quit R.    >

How to install R Packages from CRAN on Debian 10

In this step, you see that the available abundance of add-on packages is one of the R privileges. To output ASCII graphs that include scatterplot, line plot, density plot, acf, and bar charts install txtplot library.

install.packages('txtplot')
Output
...  Installing package into ‘/usr/local/lib/R/site-library’  (as ‘lib’ is unspecified)  . . .

Point: By receiving the above output, you can see where the package will be installed. And This site-wide path is available because you ran R as root. This is the correct location to make the package available to all users.

Load txtplot after the installation is complete.

library('txtplot')

You can ensure that the library has successfully loaded if you can not see any error messages. Have a look at the below example to verify a basic plotting function with axis labels.

txtplot(cars[,1], cars[,2], xlab = 'speed', ylab = 'distance')
Output
      +----+-----------+------------+-----------+-----------+--+    120 +                                                   *    +        |                                                        |  d 100 +                                                   *    +  i     |                                    *                *  |  s  80 +                          *         *                   +  t     |                                       * *    *    *    |  a  60 +                          *  *      *    *      *       +  n     |                        *         * *  * *              |  c  40 +                *       * *    *  *    * *              +  e     |         *      *  * *  * *  *                          |     20 +           *    *  * *       *                          +        |  *      *    *                                         |      0 +----+-----------+------------+-----------+-----------+--+             5          10           15          20          25                                     speed

Point: The example data, supplied by R’s datasets package, contains the speed of cars and the distance required to stop based on data from the 1920s:

In addition, please be aware that you can install any precompiled package from CRAN with install .packages().

Also, you can type q() to exit R or save the workspace image by pressing n.

Conclusion

In this article, you learned How to Install R on Debian 10. If you have succeeded to pass the steps of this guide, R is installed on your Debian system now.  In case you are interested in learning more about this subject, read a related article How to install R on Ubuntu 20.04.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

20 thoughts on “Tutorial Install R on Debian 10

    1. If you follow the below path you will be able to do that.
      Click on package and data and select install packages in the R menu. Then select local package above and press the install in the window that opens. Next, locate the file BMS-0… and finally close and re-open R

    1. Yes. Sure. It is possible if you follow the below path:

      • PackageUrl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz" install.packages(PackageUrl, repos=NULL, type="source") • require(devtools) ... • library(remotes)

    1. It is not needed. I guess you have updated to a new version, otherwise you just need to type this as a command of R to install each package. In conclusion, you do not have to install it again while you are using the version of R every time a package is installed

  1. why did I face this:
    ERROR: ‘configure’ exists but is not executable — see the ‘R Installation and Administration Manual’

    1. To solve this issue, you need to set the the TMPDIR environment variable which R will use as the compilation directory. For csh shell:
      mkdir ~/tmp
      setenv TMPDIR ~/tmp

    1. If the version of R under which the package was compiled does not match your installed version of R you will get the message above. But it is possible to handle it! You should just download the package source and install:
      R CMD INSTALL ncdf_1.6.6.tar.gz

    1. It is not necessary to update R regulary. But to make sure of having all the latest functionally and resources, you can update it.

Leave a Reply

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

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day