Skip to content

Commit b9aeac2

Browse files
authored
Merge pull request #111097 from Bowen-Guo/bowguo/execute_r_script
Update doc of Module Execuete R Script to reduce user error
2 parents 6f4b119 + 251c745 commit b9aeac2

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

articles/machine-learning/algorithm-module-reference/execute-r-script.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,24 @@ azureml_main <- function(dataframe1, dataframe2){
4040
```
4141

4242
## Installing R packages
43-
To install additional R packages, use the `install.packages()` method. Be sure to specify the CRAN repository. Packages are installed for each **Execute R Script** module, and aren't shared across other **Execute R Script** modules.
43+
To install additional R packages, use the `install.packages()` method. Packages are installed for each **Execute R Script** module, and aren't shared across other **Execute R Script** modules.
44+
45+
> [!NOTE]
46+
> Please specify the CRAN repository when installing packages such as `install.packages("zoo",repos = "http://cran.us.r-project.org")`
4447
4548
This sample shows how to install Zoo:
4649
```R
4750
# R version: 3.5.1
4851
# The script MUST contain a function named azureml_main
4952
# which is the entry point for this module.
5053

51-
# The entry point function can contain up to two input arguments:
54+
# Please note that functions dependant on X11 library
55+
# such as "View" are not supported because X11 library
56+
# is not pre-installed.
57+
58+
# The entry point function MUST have two input arguments.
59+
# If the input port is not connected, the corresponding
60+
# dataframe argument will be null.
5261
# Param<dataframe1>: a R DataFrame
5362
# Param<dataframe2>: a R DataFrame
5463
azureml_main <- function(dataframe1, dataframe2){
@@ -73,7 +82,13 @@ The following example shows how to upload an image file in the **Execute R Scrip
7382
# The script MUST contain a function named azureml_main
7483
# which is the entry point for this module.
7584

76-
# The entry point function can contain up to two input arguments:
85+
# Please note that functions dependant on X11 library
86+
# such as "View" are not supported because X11 library
87+
# is not pre-installed.
88+
89+
# The entry point function MUST have two input arguments.
90+
# If the input port is not connected, the corresponding
91+
# dataframe argument will be null.
7792
# Param<dataframe1>: a R DataFrame
7893
# Param<dataframe2>: a R DataFrame
7994
azureml_main <- function(dataframe1, dataframe2){
@@ -120,14 +135,26 @@ Datasets stored in the designer are automatically converted to an R data frame w
120135

121136
1. In the **R script** text box, type or paste valid R script.
122137

138+
> [!NOTE]
139+
> Please be very careful when writing your script and makes sure there is no syntax error, such as using a un-declared variable or a un-imported module or function. Also pay extra attentions to the pre-installed package list in the end of this document. To use packages that are not listed, please install them in your script such as `install.packages("zoo",repos = "http://cran.us.r-project.org")`
140+
141+
> [!NOTE]
142+
> Functions dependant on X11 library such as "View" are not supported because X11 library is not pre-installed.
143+
123144
To help you get started, the **R Script** text box is pre-populated with sample code, which you can edit or replace.
124145

125146
```R
126147
# R version: 3.5.1
127148
# The script MUST contain a function named azureml_main
128149
# which is the entry point for this module.
129150

130-
# The entry point function can contain up to two input arguments:
151+
# Please note that functions dependant on X11 library
152+
# such as "View" are not supported because X11 library
153+
# is not pre-installed.
154+
155+
# The entry point function MUST have two input arguments.
156+
# If the input port is not connected, the corresponding
157+
# dataframe argument will be null.
131158
# Param<dataframe1>: a R DataFrame
132159
# Param<dataframe2>: a R DataFrame
133160
azureml_main <- function(dataframe1, dataframe2){
@@ -144,8 +171,8 @@ Datasets stored in the designer are automatically converted to an R data frame w
144171

145172
* The script must contain a function named `azureml_main`, which is the entry point for this module.
146173

147-
* The entry point function can contain up to two input arguments: `Param<dataframe1>` and `Param<dataframe2>`
148-
174+
* The entry point function must have two input arguments: `Param<dataframe1>` and `Param<dataframe2>`, even when these two arguments are not used in the function.
175+
149176
> [!NOTE]
150177
> The data passed to the **Execute R Script** module is referenced as `dataframe1` and `dataframe2`, which is different from Azure Machine Learning designer (the designer reference as `dataset1`, `dataset2`). Please check to make sure input data is referneced correctly in your script.
151178

@@ -191,7 +218,14 @@ The following sample shows how to scale and normalize input data:
191218
# R version: 3.5.1
192219
# The script MUST contain a function named azureml_main
193220
# which is the entry point for this module.
194-
# The entry point function can contain up to two input arguments:
221+
222+
# Please note that functions dependant on X11 library
223+
# such as "View" are not supported because X11 library
224+
# is not pre-installed.
225+
226+
# The entry point function MUST have two input arguments.
227+
# If the input port is not connected, the corresponding
228+
# dataframe argument will be null.
195229
# Param<dataframe1>: a R DataFrame
196230
# Param<dataframe2>: a R DataFrame
197231
azureml_main <- function(dataframe1, dataframe2){

0 commit comments

Comments
 (0)