Helix/bwVisu/RStudio: Difference between revisions
Jump to navigation
Jump to search
S Richling (talk | contribs) No edit summary |
H Schumacher (talk | contribs) (Added instructions to change R version) |
||
Line 1: | Line 1: | ||
[https://posit.co/products/open-source/rstudio-server/ RStudio] is an integrated development environment (IDE) for programming with R. It can handle Python code, too. |
[https://posit.co/products/open-source/rstudio-server/ RStudio] is an integrated development environment (IDE) for programming with R. It can handle Python code, too. |
||
⚫ | |||
== Change R Version== |
|||
By default, the default R version on Helix is used. You can view the current default version by executing <code>module -t -d avail 2>&1 | grep math/R</code> on Helix. |
|||
=== Change the R version to one of the available versions on Helix === |
|||
# Open or create the file <code>.bashrc</code> in your home directory, either by [https://wiki.bwhpc.de/e/Helix/Login opening a shell on Helix] or by starting the RStudio app on bwVisu and opening the file there. |
|||
# Add the following line to your .bashrc file: |
|||
#: <syntaxhighlight lang="bash">export R_MODULE_VERSION=<available R version on Helix></syntaxhighlight> |
|||
#: for example <code>export R_MODULE_VERSION=4.2.1</code>. |
|||
# (Re)start RStudio |
|||
=== Change the R version to a version unavailable on Helix === |
|||
# Open a shell on Helix by [https://wiki.bwhpc.de/e/Helix/Login sshing into Helix] or by starting the RStudio app on bwVisu and switching to the terminal tab. |
|||
# [https://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-R-be-obtained_003f-1 Download] your desired R version, [https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Getting-and-unpacking-the-sources-1 unpack it] and change into the unpacked directory: |
|||
#: <syntaxhighlight lang="bash">tar -xf R-x.y.z.tar.gz |
|||
cd R-x.y.z.tar.gz</syntaxhighlight> |
|||
#: where <code>x.y.z</code> denotes the version of your downloaded R installation files. |
|||
# Patch the configuration file to make it compatible with your shell environment on Helix: |
|||
#: <syntaxhighlight lang="bash">sed '/date-time conversions do not work in 2020/s/^/: #/' -i configure</syntaxhighlight> |
|||
# Install R into a chosen location in your home directory: |
|||
#: <syntaxhighlight lang="bash">./configure prefix=$HOME/path/in/your/home/directory |
|||
module load devel/java |
|||
make |
|||
make install</syntaxhighlight> |
|||
# Make your installed R version the default by exporting the location of its binary to your <code>PATH</code>: Open or create the file <code>.bashrc</code> in your home directory and add the following line: |
|||
#: <syntaxhighlight lang="bash">export "PATH=/path/to/your/R/installation/directory/bin:$PATH"</syntaxhighlight> |
|||
#: Please make sure that the suffix <code>/bin</code> is added to the path to the installation location of your custom R version. This is the default location where the binaries of R will be usually installed. |
|||
# Test the installation: Reload your bash environment and obtain the version of the R binary in your path: |
|||
#: <syntaxhighlight lang="bash">source $HOME/.bashrc && R --version</syntaxhighlight> |
|||
#: If the displayed version number is equal to the one of your custom R installation, then the installation was successfull and your custom R version will be automatically loaded in RStudio. |
|||
# (Re)start RStudio |
|||
⚫ | |||
* Add a new package to RStudio |
* Add a new package to RStudio |
Revision as of 13:49, 4 March 2025
RStudio is an integrated development environment (IDE) for programming with R. It can handle Python code, too.
Change R Version
By default, the default R version on Helix is used. You can view the current default version by executing module -t -d avail 2>&1 | grep math/R
on Helix.
Change the R version to one of the available versions on Helix
- Open or create the file
.bashrc
in your home directory, either by opening a shell on Helix or by starting the RStudio app on bwVisu and opening the file there. - Add the following line to your .bashrc file:
export R_MODULE_VERSION=<available R version on Helix>
- for example
export R_MODULE_VERSION=4.2.1
.
- (Re)start RStudio
- Open a shell on Helix by sshing into Helix or by starting the RStudio app on bwVisu and switching to the terminal tab.
- Download your desired R version, unpack it and change into the unpacked directory:
tar -xf R-x.y.z.tar.gz cd R-x.y.z.tar.gz
- where
x.y.z
denotes the version of your downloaded R installation files.
- Patch the configuration file to make it compatible with your shell environment on Helix:
sed '/date-time conversions do not work in 2020/s/^/: #/' -i configure
- Install R into a chosen location in your home directory:
./configure prefix=$HOME/path/in/your/home/directory module load devel/java make make install
- Make your installed R version the default by exporting the location of its binary to your
PATH
: Open or create the file.bashrc
in your home directory and add the following line:export "PATH=/path/to/your/R/installation/directory/bin:$PATH"
- Please make sure that the suffix
/bin
is added to the path to the installation location of your custom R version. This is the default location where the binaries of R will be usually installed.
- Test the installation: Reload your bash environment and obtain the version of the R binary in your path:
source $HOME/.bashrc && R --version
- If the displayed version number is equal to the one of your custom R installation, then the installation was successfull and your custom R version will be automatically loaded in RStudio.
- (Re)start RStudio
Add R packages
- Add a new package to RStudio
- Login to bwForCluster Helix or start the RStudio app on bwVisu and switch to the Terminal tab.
- Follow the instructions from the R page
- To create dashboards, you can use RShiny with bwVisu RStudio as well.