Where does RStudio look for default version of R if not defined in `rsession-which-r` or in system PATH?

I'm working on a Linux server with RStudio open-source. Right now, my admins have the default version of R set in the rserver.conf as follows:

# Point To 3.5.3
rsession-which-r=/opt/R/R-3.5.3/bin/R

Suppose they were to remove that setting and restart the server. Then, as I understand from reading the documentation, "RStudio uses the version of R pointed to by the output of the following command: which R" .
Interestingly, running which R produces the following:

alias R='/opt/rVersionSelect.sh'
        /opt/rVersionSelect.sh

The script for rVersionSelect.sh is the following:

#!/bin/bash

RDIR=/opt/R

echo "Available Versions:"
echo "------------------------"

for rVer in $RDIR/* ; do
    echo $(echo $rVer | cut -d- -f2)
done

read -n 5 -p "Enter The R Version You'd Like To Run: " RunThisVersion

if [ -d $RDIR/R-$RunThisVersion/ ] ; then
    echo "Loading $RunThisVersion...."
    wait 10
    clear
    $RDIR/R-$RunThisVersion/bin/R --interactive
else
    echo "Unrecognized Version: $RunThisVersion"
fi

When in the Linux Terminal, this effectively allows the user to choose which of multiple versions of R they want to run.

If the default version of R were removed by unsetting rsession-which-r , would users be able to choose which version of R they wanted to run within RStudio's console?

The document I referred to earlier says "The which command performs a search for the R executable using the system PATH. RStudio will therefore by default bind to the same version that is run when R is executed from a terminal." Without a specific version of R referenced in the system PATH and without setting rsession-which-r, where does RStudio go next to determine the default version of R?

To help us understand more context, what is the use case in which you would not want R in your path or configured in rsession-which-r?

Users may want to choose different versions of R. Assigning a value to rsession-which-r forces everyone to use the same version of R.

The desire for this choice is evident from the script used in the system path. If a user enters R from the server Terminal, they get this choice. In contrast, users in RStudio are forced to use R 3.5.3, since that version's assigned to rsession-which-r .

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.