How To Install R on Debian 11

Estimated reading: 2 minutes 791 views

R is a programming language that is often utilized by statisticians because of its capabilities in statistical computing. In this tutorial, we will describe how to install R on Debian 11.

Features of RStudio:

  • Syntax highlighting, code completion, and smart indentation
  • Integrated support for Git and Subversion
  • Execute R code directly from the source editor
  • Quickly jump to function definitions
  • Easily manage multiple working directories using projects
  • Integrated R help and documentation
  • Interactive debugger to diagnose and fix errors quickly
  • Extensive package development tools
  • Support for interactive graphics with Shiny and ggvis
  • Supports authoring HTML, PDF, Word Documents, and slide shows

Step 1: Update system

Update the system package index and upgrade all installed packages to the latest.

apt update
apt -y upgrade

Step 2: Install R on Debian 11

We need to install the r-base package which contains the basic R functions that let you perform arithmetic operations and basic programming in R. Use the command below to install.

apt -y install r-base

Step 3. Test the Installation

Launch R.

R

To exit R, type:

q()

Then press ENTER. When prompted to save the workspace image, answer Y to save the workspace, N to exit without saving, or C to cancel and return to R.

Step 4. Install Packages

R packages extend the capabilities of R. Packages are only available to the user who installed them unless they are installed by the root user.

Start R.

R

Install the package. Replace “example” with the desired package.

> install.packages("example")

Here is a list of useful R packages.

A Demo with txtplot

The txtplot library can output many different kinds of charts in ASCII.

Start R.

R

Install the txtplot package.

> install.packages('txtplot')

Load the txtplot package.

> library('txtplot')

Plot the speed and distance required for a car to stop, using R’s default datasets package.

> txtplot(cars[,1], cars[,2], xlab = 'speed', ylab = 'distance')

The output looks like this:

Getting Help

Use the help command to learn more about a library. For example, to learn more about the txtplot library, run the following command.

> help(txtplot)

In this post, you learned how to install R on Debian 11 Linux distribution.

Leave a Comment

Share this Doc

How To Install R on Debian 11

Or copy link

CONTENTS