Editing Mini-app's source code
When you create a Mini-app in the workspace, a folder containing all the app's scripts and files is also created. You can view and edit the code by navigating to the Files tab and moving inside the folder named after your Mini-app. Note that any libraries that the Mini-app uses will need to be installed in the workspace R Console.
If you edit the source code while the Mini-app is running, you will see a notice reminding you to refresh the app in order for the changes to be applied.
Adding an image to your Mini-app tile
You can add an image to your Mini-app tile, this image must be saved directly in the Mini-app's folder and should be named 'tile.png'.
The recommended image size is 336 pixels by 150 pixels. Please note that the bottom 30 pixels will be covered by the action buttons.
If you add an image, the name of the Mini-app will no longer be visible on the tile. Thus, the image should include the name of the app.
The tile on the right shows the default Mini-app image. The tile on the left had a custom image added to its source code.
Mini-apps and R versions
Mini-apps can be set to run on a specific version of R. When creating a new Mini-app, you can choose which version of R you wish the Mini-app to run on. This will be specified in a
.version file saved in your Mini-app folder.
If you wish to change the version of R, edit the
.version file and save it. Note, the version you select must be available in your workspace. Additionally, if the version later becomes unavailable, the Mini-app will run on the default version of R unless you change the configuration in the
The format of the R version can be any of the following (e.g. for R 3.6.3):
Workspaces currently support 4.0.2, 3.6.3, 3.5.3 as well as a Legacy R 3.5.0 which can be used with scripts migrated from an Analytixagility workspace (Workspaces version 1.25 or earlier). To use Legacy R, enter
r_legacy in the version file.
If you specify an incomplete version, such as 3.6, or a complete but non-available version, such as 3.6.6, the Mini-app would use the highest complete version available, such as 3.6.3.
Importing data into a Mini-app
As part of your Mini-app, you may wish to import files stored within your workspace. For CSV files, this can be done using readr library:
library(readr) dataset <- read_csv("~/files/your_folder/file_name.csv")
You can also import datasets located in the workspace using the following function:
For more information, see the reading and writing data in R article.