question

GrahamBenson-6517 avatar image
0 Votes"
GrahamBenson-6517 asked romungi-MSFT answered

Execute R Script in ML Studio

Hi,

I am trying to runt the following R Script in an 'Execute R Script' module in Machine Learning Studio.

data.set <- data.frame(installed.packages())
maml.mapOutputPort("data.set")

This script is taken from the 'Get started with Machine Learning Studio (classic)' in R page (https://docs.microsoft.com/en-au/azure/machine-learning/classic/r-get-started#timeseries)

Whilst it works in ML (classic) I receive the following error when running it in Machine Learning Studio;

Error in maml.mapOutputPort("data.set"): could not find function "maml.mapOutputPort"

What additional config settings are needed to enable R scripts in ML Studio?

Thank you.

azure-machine-learning
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

romungi-MSFT avatar image
0 Votes"
romungi-MSFT answered

@GrahamBenson-6517 For the designer version of the Azure ML studio you could follow the steps in this document to install the packages and run any R scripts. Unlike the classic version you need to select or create compute for your experiment before the experiment can be submitted.

Example for installing a package:

 azureml_main <- function(dataframe1, dataframe2){
   print("R script run.")
      
   if(!require(zoo)) install.packages("zoo",repos = "http://cran.us.r-project.org")
   library(zoo)
   # Return datasets as a Named List
   return(list(dataset1=dataframe1, dataset2=dataframe2))
 }


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the response @romungi.

I have been able to successfully run the following code to list the preinstalled R packages.

azureml_main <- function(dataframe1, dataframe2){
print("R script run.")
dataframe1 <- data.frame(installed.packages())
return(list(dataset1=dataframe1, dataset2=dataframe2))
}

I was also able to install a different package using your example for 'zoo'

1 Vote 1 ·