In the SPEC tab of the Component Editor you'll configure your component, including loading dependencies. This article covers loading dependencies for R components.

(For a primer on what it's like working with R in the Exaptive Studio, check out the R article in our Working with Your Favorite Technology section.)

CRAN packages can be installed by specifying them as "cran" dependencies in the component's spec file. When such dependencies are specified, the Exaptive system will try to create a new  

Docker container for the component containing the requested packages on spec save.

Specifying cran dependencies is equivalent to installing CRAN packages with the following commands in R, where <dep1> and  <dep2> are replaced by actual package names: 

> install.packages("<dep1>")
> install.packages("<dep2>")

Please see the example below on how to specify the names.

If the installation is successful, the packages can be used from within your component script as you would in any other R script.

 In your SPEC file: 
"dependencies": {
  "cran": [
    {"path": "rjson"}

In your SCRIPT:


myinput <- function(self) {
  statejson <- v_export(self$api$inputstate, "json")
  state <- rjson::fromJSON(statejson)



With the release of version 4.6.2 of the studio, cran dependencies can optionally have a version number.

  "path": "rjson",
  "version": "0.2.12"

If no version is provided, the latest version is used. Since this was how the version was selected prior to this feature, this feature is backwards compatible. See the cran archive for available versions: