This topic describes the process for initializing RStudio to enable the viewing of the LabKey schema within RStudio or RStudio Workbench. By default this option is enabled.
Note: To use this feature, you must have the latest version of
Rlabkey.
Configuration
Follow the steps for configuring LabKey to access your RStudio or RStudio Workbench instance following the instructions in one of these topics:
On the Configure RStudio page for either type of integration, scroll down and confirm that the box for
Initialize Schema Viewer is checked.
Use the LabKey Schema within RStudio
The RStudio viewer will now allow you to browse the LabKey schema. Select a project from the menu circled in this screenshot, then select a folder to see the schema it contains, and a schema to see the queries it contains.
Use LabKey Data with RStudio Shiny Apps
Once you have integrated either RStudio or RStudio Workbench with LabKey Server, you can create Shiny reports in RStudio that present LabKey data. This example shows an RStudio Shiny app giving user control of a live visualization of viral load over time.
Extend Initialization
An RStudio system administrator can add or overwrite variables and settings during initialization by including an R function in the Rprofile.site file which calls the hidden/named function "labkey.rstudio.extend". When performing this initialization, a one time "requestId" is used, rather than a more persistent api key.
As an example, the following code introduces a simple call of this function which will print a 'Welcome' message (ignoring the self-signed certificate):
## define labkey.rstudio.extend function here, which will be called on RStudio R session initialization
# ## Example:
# labkey.rstudio.extend <- function() cat("nWelcome, LabKey user!nn")
library("Rlabkey")
labkey.acceptSelfSignedCerts()
RStudio executes the hidden function upon initialization:
Related Topics