rml-studio

How to map output of Execute R Script to second port in ML Studio using maml.mapOutputPort


Execute R Script box in ML Studio has two output ports. How does one send data to the second output port?


Solution

  • Currently ML Studio does not support the mapping of output data to a second port. This can be verified by executing the following code:

    # Map 1-based optional input ports to variables
    dataset1 <- maml.mapInputPort(1) # class: data.frame
    
    # Select data.frame to be sent to the output Dataset port
    maml.mapOutputPort("dataset1", 1);
    maml.mapOutputPort("dataset1", 2);
    

    which returns

    ---------- Start of error message from R ----------
    Error: At this time, there is only 1 output dataset port that can be mapped. Please provide 1 as the portNumber 
    

    As a workaround you can output your data.frame with an additional column labeling which output set is intended. Then Clean Missing Data with action Remove entire row can be used to truncate the data to the correct output and Select Columns in Dataset and be used to remove the extraneous column.