To use RStudio® Workbench, your platform administrator must first configure its operational license in Control Panel.
Code Workspaces enables you to use RStudio® Workbench ↗ in Foundry. RStudio® Workbench in Code Workspaces supports:
Code Workspaces currently supports Shiny® ↗ for R applications. Users can create applications directly in Code Workspaces with Foundry’s version control, branching, and data governance features built-in.
Code Workspace applications support branching. If you create a new Workspace branch, publishing a new application or synchronizing the changes will publish a new version of the application on that branch. This allows you to preview your application before exposing it to your users. To publish on the master branch, simply merge your branch into master.
With Code Workspaces, you can create a Shiny® application and preview it directly from the RStudio® UI.
By default, RStudio® generates Shiny® applications in the home folder (/home/user
) but Foundry requires applications to be in the git repository /home/user/repo
for them to be persisted across sessions and published.
In Code Workspaces, select Publish application, select a location in your Files and Projects for your new application, and enter the name of the directory in which a new Shiny® app.R
file should be automatically created, relative to the repository root /home/user/repo
. This field can be left blank to create the application at the root of the repository. By default, the application settings will match the RStudio® workspace settings, and configuring advanced settings is optional.
Published Shiny applications are subject to a 30-second timeout, meaning that the Shiny server must start up within 30 seconds of executing your Shiny application file. Otherwise, your Shiny application will fail to start up.
Select Publish and sync to register your new Shiny® application and sync the code to the backing code repository. After CI checks and publishing are complete, you can select the link in the Applications panel to view the published application.
To develop locally against a Shiny® application:
app.R
in RStudio®.By default, Shiny greys out if the websocket connection is closed, for instance if there is a network outage for over 15 seconds. To ensure your application can recover when the network connection is restored, we recommend updating the server
function to set session$allowReconnect("force")
:
server <- function(input, output, session) {
# Handle input changes
session$allowReconnect("force")
}
This will cause the frontend to trigger a new websocket when the network is available again, and to send the last input information that was set in the UI.
R transforms currently do not support making API calls to external services, even if the network policy was added in the RStudio Code Workspace.
R scripts written in Code Workspaces can be registered as transforms for output datasets in Code Workspaces.
Follow the steps below to register a transform for an output dataset:
Once CI checks are completed, your transform is ready for build. You can then use other Foundry data integration tools to manage your transform and the data pipeline to which it belongs.
The transform does not automatically use the environment of the Code Workspace. You should install all the packages needed at runtime at the top of the script file. The code snippet to install a package can be found in the Packages panel.
For example, to use dplyr
and tidyr
in your transform, add this code snippet to the top of the file:
renv::install(c("dplyr", "tidyr"))
Learn more about R transforms.
RStudio® and Shiny® are trademarks of Posit™.
All third-party trademarks (including logos and icons) referenced remain the property of their respective owners. No affiliation or endorsement is implied.
R Markdown files written in RStudio® workspaces can be shared with other Palantir platform users with R Markdown Reports. A report is a dataset built from an R Markdown file using a transform, containing HTML produced by rendering the R Markdown file with Quarto ↗.
Reports are built using transforms, so they can be configured to automatically update based on the latest changes to the R Markdown file using a schedule. This ensures that your analyses and visualizations are up-to-date and built with a reproducible, customizable workflow that integrates with the rest of the Palantir platform.
An R Markdown report can be published in an RStudio® workspace using the following steps:
To edit or delete an existing report, select ... on the right of the report card. This will open a menu with options to edit or delete the report, and an option to copy the link to the report.
Reports support full version history. To view a previous version of a report, expand the report card in the Applications side panel or use the version selector in the page header when viewing a report in a new tab.
Selecting a report version will update the link used to share the report, enabling you to share a specific historical version of a report that will not be updated if the underlying R Markdown is modified.
The latest version of a report will be selected by default, so readers of your report automatically receive the latest changes.