Connect to RStudio Workbench

2024-03-29

Premium Feature — This feature supports RStudio, which is part of the Professional and Enterprise Editions of LabKey Server. Learn more or contact LabKey for details.

RStudio Workbench (previously RStudio Server Pro) supports running multiple RStudio sessions per user, and multiple versions of R simultaneously.

Prerequisite: Set Up RStudio Workbench

To set up RStudio Workbench to connect to LabKey, follow the instructions and guidance in this topic:

Once RStudio Workbench is correctly configured, the RStudio Workbench Admin should provide you with:
  • The absolute URL of RStudio Workbench
  • The Security Token customized to authenticate LabKey. Default is 'X-RStudio-Username'
You may also wish to confirm that RStudio Workbench was restarted after setting the above.

Version Compatibility

LabKey Server version 23.3 has been confirmed to work with RStudio Workbench version 2022.07.1.

Configure RStudio Workbench in the Admin Console

  • Select (Admin) > Site > Admin Console.
  • Under Configuration, click Site Settings.
  • Set the Base Server URL (i.e. not "localhost").
  • Click Save.
  • Click Settings
  • Under Premium Features, click RStudio Settings.
  • Select Use RStudio Workbench.

Enter the Configuration values:

  • RStudio Workbench URL: The absolute URL of RStudio Workbench.
  • Authentication: Select either Email or Other User Attribute:
    • Email: Provide the User Email Suffix: Used for LabKey to RStudio Workbench user mapping. The RStudio Workbench user name is derived from removing this suffix (Ex. "@labkey.com") from the user's LabKey Server email address.
    • Other User Attribute: For example, LDAP authentication settings can be configured to retrieve user attributes at authentication time. Provide the Attribute Name for this option.
  • Security Token: The HTTP header name that RStudio is configured to use to indicate the authenticated user. Default is 'X-RStudio-Username'.
  • Initialize Schema Viewer: Check the box to enable the viewing of the LabKey schema from within RStudio. See Advanced Initialization of RStudio for more information.

Testing RStudio Workbench Connection

Before saving, you can use Test RStudio Workbench to confirm the connection and security token. When successful the message will read:

RStudio Workbench server connection test succeeded. Launch RStudio to verify $rStudioUserName$ is a valid RStudio user.

Proceed to launch RStudio Workbench via > Developer Links > RStudio Server. If the rstudioUserName you provided is valid, you will be logged in successfully. If not, you will see a warning message provided by RStudio Workbench.

Note that previous versions of Rstudio Server Workbench/Pro allowed LabKey to determine validity of the username. Find documentation for earlier versions in our archives: Testing RStudio Workbench/Pro Connections

Troubleshooting unsuccessful results of Test RStudio Workbench:

  • An error response may indicate the incorrect URL for RStudio Workbench was entered, or that URL is unreachable. Try reaching the URL in a browser window outside of LabKey.
  • A warning response may be due to an invalid security token.

Launch RStudio Workbench

  • Select (Admin) > Developer Links > RStudio Server.

When you launch RStudio Workbench, you will see your home page. If you have multiple sessions, click on one to select it.

Now you can use RStudio Workbench to edit R reports and export data. Learn more in these topics:

Related Topics