How to Install R and RStudio on Fedora 39, 38 Linux

When it comes to statistical computing and graphics, R has established itself as the programming language of choice since its inception in 1993 by Ross Ihaka and Robert Gentleman. Complementing this language, RStudio provides an integrated development environment (IDE) aimed at enhancing the user’s coding experience. Together, they are indispensable tools for data analysts and researchers. In this guide, we will walk through the key features of R and RStudio and demonstrate how to install R and RStudio on Fedora Linux.

Key Features and Advantages:

  • Statistical Analysis: R is equipped with various statistical functions, suitable for various data analysis needs.
  • Visualization Tools: The language boasts strong visualization packages such as ggplot2, facilitating the creation of insightful graphics.
  • Comprehensive Package Ecosystem: CRAN hosts myriad packages that extend R’s functionality to different specialized areas.
  • Open-Source Collaboration: R and RStudio benefit from their open-source nature, enjoying regular updates from a worldwide community.
  • Enhanced Coding Experience: RStudio adds to the appeal with syntax highlighting, code completion, and other productive features.
  • Cross-Platform Availability: Users can run R and RStudio across different operating systems, ensuring flexibility.
  • Facilitated Teamwork: RStudio’s support for R Markdown and Shiny promotes a cooperative approach to data analysis projects.

Armed with these capabilities, R and RStudio offer a dynamic and user-friendly environment for data exploration and analysis. As a favored solution among professionals in diverse fields, R stands as a testament to the power of collaborative development. With this background on the software, we are set to proceed with “How to Install R and RStudio on Fedora Linux.”

Install R Lang on Fedora Linux

Step 1: Update Fedora Before R Lang Installation

Before the R language installation, ensure your Fedora system is up to date. Execute the following command in the terminal to refresh and upgrade your system packages:

sudo dnf upgrade --refresh

This command ensures all existing packages are updated and any available system improvements are applied, paving the way for a smoother installation of new software.

Install R Lang on Fedora via DNF Command

Fedora Linux provides a convenient method to install the R programming language through its default package manager, DNF.

Option 1: Basic R Language Installation

For a standard installation of R, which includes the core components sufficient for most use cases, use the command:

sudo dnf install R

This installation includes the primary R language functionalities required for statistical computations and graphics.

Option 2: Install R Programming Language with Dependencies

To include all dependencies that enhance R’s functionality, especially for development purposes, use the command:

sudo dnf install -y R-core R-core-devel R-java R-java-devel libRmath libRmath-devel

Here’s what each package comprises:

  • R-core: Contains the fundamental R language components, essential libraries, and datasets.
  • R-core-devel: Provides necessary headers and development tools for building R packages.
  • R-java: Integrates Java support in R, useful when working with Java libraries or applications.
  • R-java-devel: Supplies headers and tools for building R packages that require Java.
  • libRmath: Includes the mathematical functions used within R for advanced calculations.
  • libRmath-devel: Offers development resources for R packages relying on mathematical functions.

For specific compilation scenarios, additional libraries may be needed to ensure full functionality:

sudo dnf install libcurl-devel openssl-devel harfbuzz-devel fribidi-devel freetype-devel libpng-devel libjpeg-turbo-devel

These libraries address specific requirements such as secure data transfer, text rendering, and image processing, which are crucial for R packages that depend on these capabilities.

Install R Lang with RStudio on Fedora Linux

The following two installation methods will install R Lang, but this time with the RStudio Desktop.

Option 3: Installing R with RStudio IDE

For users who require an Integrated Development Environment (IDE) along with the R language, installing RStudio Desktop is the optimal route. First, ensure R is installed:

sudo dnf install R

Following R installation, proceed to install RStudio Desktop:

sudo dnf install rstudio-desktop

RStudio Desktop provides an extensive environment for R development, making it more straightforward to write, debug, and visualize your R code. This setup is ideal for developers seeking a cohesive workspace for statistical computing and graphics.

Option 4: Install R Programming Language with RStudio and Dependencies

To facilitate a full development setup with RStudio and R language dependencies:

sudo dnf install -y R-core R-core-devel R-java R-java-devel libRmath libRmath-devel rstudio-desktop

This command not only installs R and RStudio but also all essential components for robust development activities, such as package development and integration with Java-based applications.

Including R-core-devel, R-java-devel, and libRmath-devel ensures that all the necessary development headers and tools are available for compiling complex R projects. This comprehensive installation supports advanced R functionalities, which can benefit developers working on intricate statistical models or integrating R with other software.

Verifying R Language Installation on Fedora

Step 1: Confirming R Installation

Once you have completed the installation of R and its related packages, it’s crucial to ensure that the setup was successful. Open the terminal and initiate the R environment with the following command:

R

Step 2: Exit R Console

If the installation is correct, the R console will appear. Here, you can execute R commands, explore datasets, and perform statistical analysis. To conclude the R session and return to the terminal, enter:

q()

When prompted to save the workspace image, you can type ‘n’ to exit without saving or ‘y’ to save the current R workspace for future sessions. This verification step confirms that R is properly installed and functional on your Fedora system and ready for data exploration and analytical tasks.

Launching RStudio Desktop on Fedora

Starting RStudio from the Terminal

To open RStudio directly using the command-line interface, enter the following command in your terminal:

rstudio

This command activates the RStudio IDE, a powerful tool for statistical computing and graphics, which integrates well with the R programming language installed on your Fedora system.

Opening RStudio via the GUI

Alternatively, you can launch RStudio using the Fedora graphical user interface. Navigate through the following path:

Activities > Show Applications > RStudio

Clicking the RStudio icon will initiate the IDE, providing a user-friendly environment for developing in R. This method benefits users who prefer working within a graphical interface rather than the command line.

Screenshot showing the RStudio Desktop application icon on Fedora Linux for launching the software.
Click to launch RStudio Desktop on Fedora Linux: An illustrative screenshot of the application icon.
Screengrab displaying the RStudio graphical interface on a Fedora Linux system.
Get to know the RStudio graphical interface on Fedora Linux through this detailed screenshot.

Install R Packages from CRAN

Step 1: Locating R Packages on CRAN

To enhance your data analysis with R, you might need additional packages from the Comprehensive R Archive Network (CRAN), the primary repository for R packages. Begin by launching the R environment on your Fedora system with the following command:

R

Within the R console, locate a desired package by utilizing the available.packages() function, which lists all packages available for installation from CRAN. For instance:

available.packages(pattern = "ggplot2")

Replace "ggplot2" with the relevant package name to check for availability.

Step 2: Installing R Packages

After identifying the necessary package, you can install it directly from the R console. Execute the following:

install.packages("package_name")

Replace "package_name" with the actual name of the package, such as "ggplot2" to install it. This command fetches the package from CRAN and installs it and its dependencies.

Step 3: Updating R Packages

It is crucial to keep your packages up to date. To update a specific R package to its latest version on CRAN, use:

update.packages("<package name>")

Again, replace "package_name" with the actual name of the package you wish to update.

Step 4: Remove R Packages

Should you need to remove an R package from your system, the following command in the R console will suffice:

remove.packages("<package name>")

Substitute "package_name" with the name of the package you want to uninstall. This command will safely remove the selected package and its dependencies from your Fedora installation.

This will remove the package and its dependencies from your system.

Install R Packages from cran2copr

Step 1: Enable CRAN2Copr Repository

For Fedora users seeking the latest R packages, CRAN2Copr is an invaluable third-party repository. Begin by adding the repository to your system. Execute the command to install the copr plugin:

sudo dnf install 'dnf-command(copr)

After installing the plugin, enable CRAN2Copr with:

sudo dnf copr enable iucar/cran

Following the repository activation, install the Copr Manager tool, which facilitates package management from this repository:

sudo dnf install R-CoprManager

Step 2: Installing R Packages from CRAN2Copr

With CRAN2Copr enabled, you can install R packages directly. Use the following syntax:

sudo dnf install R-<package name>

For example, to install the ggplot2 package from CRAN2Copr, run:

sudo dnf install R-ggplot2

This command retrieves the specified package and any required dependencies from the CRAN2Copr repository, ensuring you have the latest version compatible with Fedora.

Finalizing Your R Setup on Fedora Linux

With the R programming language and RStudio now installed on your Fedora Linux system, you are well-equipped to tackle data analysis, machine learning, and statistical computing projects. The process, as outlined in this guide, provides a direct and efficient path to setting up a robust environment for R development. By selecting one of the detailed installation methods, you can ensure a smooth and successful installation to kickstart your data-driven endeavors.

Leave a Comment