r command not found

In this troubleshooting guide we learn how to fix r command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

r: command not found

or when using sudo you get the following error message

sudo: r: command not found

Solutions to r: command not found

How To Fix r: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu r is provided by r-cran-littler package.

r-cran-littler is:

The ‘r’ (aka ’littler’) program provides a lightweight binary wrapper around the GNU R language and environment for statistical computing and graphics.

While R can be used in batch mode, the r binary adds full support for both ‘shebang’-style scripting (i.e. using a hashmark-exclamation-path expression as the first line in scripts) as well as command-line use in standard Unix pipelines. In other words, r provides the R language without the environment.

To fix this problem, we can install more using the command below.

sudo apt-get -y install r-cran-littler

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install r-cran-littler.

sudo apt -y install r-cran-littler

Or if you have aptitude installed you can use the following command.

sudo aptitude install r-cran-littler

Summary

In this tutorial we learn how to fix r command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.