GithubHelp home page GithubHelp logo

installr's Introduction

This is a script to install multiple versions of R on linux systems that are not using R studio server pro

The original documentation for installing multiple version of R on linux can be found here.

Table of contents

I. Resources
II. Installation
III. Example
IV. Installing Rstudio server
V. Troubleshooting
VI. Closing remarks
VII. Removing Rstudio server

I. Resources

Availible R versions (minor R versions can be found in the links below).

Installation

Clone this repo from GitHub.

[email protected]:nasiegel88/installR.git

Once the script is downloaded you will need to make it executable.

chmod u+x installR.sh

Note the script needs to be run as root and will not start without root.

# Wrong
$ ./installR.sh 
This script must be run as root.

-a is the major R version and -b is the minor R version

# Correct
$ sudo ./installR.sh 
Some or all of the parameters are empty

Usage: ./installR.sh -a parameterA -b parameterB
	-a Major R version i.e. 4
	-b Minor R version i.e. 4.1.3

Example

The code below will install R_4.1.3 to the /opt directory.

sudo ./installR.sh -a '4' -b '4.1.3'

Assuming Rstudio server is installed on the system launch the server and 4.1.3 should be the version running in Rstudio.

sudo rstudio-server start

And if the default port is being used users should go to localhost:8787 using their browser of choice.

To install another version of R run the chunk below.

sudo ./installR.sh -a 4 -b 4.1.2

This will install a different version of R. In order to get Rstudio server to recognize the R version has been changed rserver.conf will need to be edited. The shell script below will make rstudio studio run what ever installed version of R is passed through the -b argument.

chmod u+x changeR.sh
sudo ./changeR.sh -b 4.1.2

Then the server will need to restarted to Rstudio to recognize the change.

sudo rstudio-server restart

To double check that the desired version of R is being run in Rstudio enter the command listed below in the Rstudio console.

R.version

platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          1.2                         
year           2021                        
month          11                          
day            01                          
svn rev        81115                       
language       R                           
version.string R version 4.1.2 (2021-11-01) # The correct version is being used!
nickname       Bird Hippie

If Rstudio server is not running the desired version of R after restarting the server try to terminate the session and start a new one.

Installing Rstudio server

sudo apt-get install gdebi-core
# Download load the most recent version of R studio server
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.02.2-485-amd64.deb
# Run the executable
sudo gdebi rstudio-server-2022.02.2-485-amd64.deb
# clean up
rm rstudio-server-2022.02.2-485-amd64.deb 

Troubleshooting

Rstudio server should now be ready to run. If there are issues starting the server try some of the solutions listed below...

I. Try telling rstudio server where to located the R

echo "export RSTUDIO_WHICH_R='/opt/R/4.1.3/bin/R'" >> ~/.profile 

II. If the open source version of rstudio server is being used remove rserver.conf and restart the server.

sudo rm /etc/rstudio/rserver.conf

III. If a very old version of R is being installed, such as anything pre-3.0 users may have an issue launching Rstudio server. If that is the case it is recommended to in install an older version of Rstudio server. Debian builds for Debian and Ubuntu can be found here. If the goal is to run R from the command line then then skip this step.

Closing remarks

It is nice to be able to switch between R versions in Rstudio with a few clicks however, to ensure reproducibility it is recommended to run R in something like mybinder or rocker (docker images for R and Rstudio) and to manager software in an environment using a package manager such as conda.

Removing Rstudio server

sudo apt-get remove --purge rstudio-server

installr's People

Watchers

Noah Siegel avatar

Forkers

lmillergrp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.