Azure Machine Learning Studio (classic): Extend your experiment with R

Note

The Notebooks (preview) feature in Studio (classic) will be shut down on April 13th, 2020. After April 13th, the Notebooks tab will be removed along with any saved notebooks. For instructions on how you can download your notebooks, see this article.

You can extend the functionality of Azure Machine Learning Studio (classic) through the R language by using the Execute R Script module.

This module accepts multiple input datasets and yields a single dataset as output. You can type an R script into the R Script parameter of the Execute R Script module.

You access each input port of the module by using code similar to the following:

dataset1 <- maml.mapInputPort(1)

Listing all currently-installed packages

The list of installed packages can change. A list of currently installed packages can be found in R Packages Supported by Azure Machine Learning Studio (classic).

You also can get the complete, current list of installed packages by entering the following code into the Execute R Script module:

out <- data.frame(installed.packages(,,,fields="Description"))
maml.mapOutputPort("out")

This sends the list of packages to the output port of the Execute R Script module. To view the package list, connect a conversion module such as Convert to CSV to the left output of the Execute R Script module, run the experiment, then click the output of the conversion module and select Download.

Download output of "Convert to CSV" module

Importing packages

You can import packages that are not already installed by using the following commands in the Execute R Script module:

install.packages("src/my_favorite_package.zip", lib = ".", repos = NULL, verbose = TRUE)
success <- library("my_favorite_package", lib.loc = ".", logical.return = TRUE, verbose = TRUE)

where the my_favorite_package.zip file contains your package.