Launch rstudio-server from terminal linux - r

I'm an Ubuntu user and I used to work with the standard version of Rstudio on my computer. After reading about the server version I installed it on my PC and I'm working with it now. Although I'm very happy with rstudio-server version, I have been facing some difficulties to keep with some old practices. Particularly, I use to launch, open and create new files from the terminal using rstudio keyword - I'm specially fond to the possibility of open files in current rstudio session through the terminal window within rstudio. However, I cannot figure out which command is equivalent in rstudio-server.
I tried, without success, the following commands:
rstudio-server
and
r-server
Interestingly, when I type which rstudio (to find the path of the program's binary files), the terminal did not return any results. The program is installed and working normally, but I just can't find it on my PC
Any help will be appreciated

Related

Unable to open Anaconda command prompt or any notebooks

Anaconda is not responding for any environment whenever I try to open a command prompt or any other application such as jupyter-notebook. I have installed Anaconda's latest available version for Windows 10. This is the 3rd time I have reinstalled the software thinking that the outcome might change but to no avail. I am able to open the command prompt from the Environments option but still, this option does not work for the jupyter-notebook. However, I am able to open the jupyter-notebook from the command prompt but the kernel dies every other minute. Please guide and help me if you can.

new version of R with rstudio

I installed a new version of R but rstudio still uses the old version. The command "which R" is just a shell script and I'm not sure how to get rstudio and the new version of R integrated. R base installed in /usr/share/doc.
Any tips?
Thanks,
Bob
See the RStudio support pages. In particular, for Linux, you have to set the RSTUDIO_WHICH_R environment variable.
As found out in the comments, you're on a Linux system, specifically Linux Mint 17. I can see three basic scenarios here:
You want to ensure RStudio uses a specific version of R when you are launching RStudio from the terminal as a one-time event.
You want to ensure RStudio uses a specific version of R every time you launch RStudio from the terminal.
You want RStudio to use a specific version of R when you launch RStudio from the applications menu (or, equivalently, via something like Synapse).
They are dealt with in turn below. I assume throughout that the path to the R binary you want RStudio to use is /opt/R/3.1.0/bin/R, which you should change as appropriate.
One-time Terminal Launch
After opening a terminal via Ctrl-Alt-T, run
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then, anytime you launch RStudio from the terminal via the rstudio command in that terminal session, it will use the specified R version. However, after you exit, the next time you open the terminal, it will no longer respect that choice.
Every Terminal Launch
Use your favorite text editor to edit the file ~/.bashrc. At the end, on a new line, add
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then, either launch the terminal, or if you already have it open run the command source .bashrc. Then, you can launch RStudio via the command rstudio and it will use the version of R you want.
Launching from the Applications Menu
Use your favorite text editor to edit the file ~/.profile. At the end, on a new line, add
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then you need to log out of your system and log back in. After that, anytime you launch RStudio from the application menu, it will use the specified R version.

devtools::install_github("imbs-hl/ranger") fails - make.exe and sh.exe unable to start correctly

I'm trying to install the development version of the R library ranger from RStudio on Windows 7 with the command:
devtools::install_github("imbs-hl/ranger")
When I try this, I first get a pop-up with the header "make.exe - Application Error" and the message "The application was unable to start correctly (0xc000007b)."
I then get a message saying that I need to install additional build tools. This downloads RTools. I then get an identical pop up like the make.exe one, except that this time it's for sh.exe. After I click ok, it then does a somewhat long install of RTools. The setup window closes and the development packages remain uninstalled.
Note: when I run either sh.exe or make.exe from the windows command line, I get the same errors. This might have something to do with the fact that I have cygwin installed.
I can get sh.exe and make.exe to run from the windows command line if I remove RTools from the path, leaving only cygwin. However, this doesn't change the problem I get when I try installing the development version of ranger.
Any help would be appreciated.

Using different version of R per user in Rstudio Server

I am using an Rstudio Server (0.98.490) on a CentOS machine, that uses the default installation in the machine which is an older version of R. I also have a newer version of R compiled elsewhere in the system. Can I, as a non-root user, tell Rstudio to use the new installation instead of the old one when I start a session?
I'm not sure if there are any peculiarities for CentOS, but I believe you should be able to change your ~/.profile or ~/.bash_profile file to include the following line: export RSTUDIO_WHICH_R=/path/to/desired/compiled/R.
You can see which version of R RStudio is currently running by entering which R into a terminal. the export command listed above should change it to your desired build.
These links might help:
https://support.rstudio.com/hc/en-us/articles/200486138-Using-Different-Versions-of-R
Running newer version of R from terminal when older version is invoked by default
Hope this helps
The first answer was relevant RStudio, not rstudio-server as the question asks. The question is addressed in the section "RStudio Desktop and RStudio Server Open-Source".
However, adding a line like export RSTUDIO_WHICH_R=/usr/local/bin/R to my ~/.profile and ~/.bash_profile does not actually seem to affect rstudio-server for me. So I am giving up for now. The Pro version seems to have other options, as listed here.
Starting in RStudio Server 1.3 (newest version is 1.4.1106, released February 22, 2021), a user’s preferred version of R can be specified in the rstudio-prefs.json file in the global-level /etc/rstudio folder or in the user-level ~/.config/rstudio folder.
See https://blog.rstudio.com/2020/02/18/rstudio-1-3-preview-configuration/ and https://docs.rstudio.com/ide/server-pro/session-user-settings.html for user setting options in newer versions of RStudio Server.
See https://support.rstudio.com/hc/en-us/articles/200716783-RStudio-Release-History for RStudio release history and https://www.rstudio.com/products/rstudio/download-server/redhat-centos/ for Red Hat downloads of the newest version of RStudio Server.

Multiple versions of R installed but can't locate or remove the old one

I have downloaded and installed R.
I see it here in Applications folder (I am on a Mac with Yosemite):
Fine. I can launch R.app and indeed, yes, I am running the version I want, which is 3.2.2:
So far so good. I can even open up RStudio and see that I am indeed running 3.2.2!
So after all this, I simply go to my terminal, type
r
and turns out I am running 3.1.1!
I understand the old user of my work computer probably had installed this older version.
So here's what I'm wondering:
If I just installed R.app correctly, WHY is this old version still living on my computer, and how do I get rid of it?
If this is some sort of $PATH thing, WHY doesn't the most obvious location for an app, the Applications folder, get checked for the existence of R?
Thanks.
UPDATE
Turns out the old version of R has been installed by homebrew.
Typing which r in your terminal will give you where the shell thinks R is. Then, you need only uninstall it from that location.
Since we've determined it's homebrew, all you need to do now is brew unlink r; rm -Rf /usr/local/Cellar/r/3.1.1 and you should be golden after you rehash in your shell.
It worked because you installed it using homebrew. To remove it from the system, you must first unlink it and then remove it from the system.

Resources