Extend your experiment with R

You can extend the functionality of Azure Machine Learning Studio 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.

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.

Note

Try Azure Machine Learning for free

No credit card or Azure subscription required. Get started now.