Run R codes in Azure ML

 

There is a possibility to run R codes and Python in Azure ML.  In this short post, I am going to show you how we can run an R codes to show some charts in Azure ML with ggplot2 package.

I have a dataset about the dairy product in the USA. this dataset holds data about the cheese, milk, and ice cream production. I want to show the statistical summary of data by drawing box plot to show the min, max, median, 1 quarter, and 3rd quarter of milk production based on the month number and the year.

There are two nodes in Azure ML studio name “Execute Python and R scripts”, as you can see in the below image.

the dataset about milk production in the USA has been shown in the below image.

I drag and drop the milk dataset into Azure ML environment. Then, I added a node for “Executing R scripts”.  This node has an editor to write the R codes.

the first statement is about getting the data from the first input node (maml.mapinputport). “Execute R scripts” able to get three different nodes. to access each node, we can change the number for “mapInputPort(1)” or 2 or 3.

I stored the data collected from the first node in dataset1. I refer to “ggplot2” package by using “library(ggplot2)”. T0 draw boxplot, a ggplot function has been used.

 

As you can see in the above picture, to show the original dataset in output node(the first in the left), mapOutputPort.

We need to run the experiment and check the output node 2 to see the result of the run. the output node in the right shows the box plot chart related to the Milk production.

Moreover, you able to see the output log of running the R codes.

 

Leila Etaati on LinkedinLeila Etaati on TwitterLeila Etaati on Youtube
Leila Etaati
Trainer, Consultant, Mentor
Leila is the first Microsoft AI MVP in New Zealand and Australia, She has Ph.D. in Information System from the University Of Auckland. She is the Co-director and data scientist in RADACAD Company with more than 100 clients in around the world. She is the co-organizer of Microsoft Business Intelligence and Power BI Use group (meetup) in Auckland with more than 1200 members, She is the co-organizer of three main conferences in Auckland: SQL Saturday Auckland (2015 till now) with more than 400 registrations, Difinity (2017 till now) with more than 200 registrations and Global AI Bootcamp 2018. She is a Data Scientist, BI Consultant, Trainer, and Speaker. She is a well-known International Speakers to many conferences such as Microsoft ignite, SQL pass, Data Platform Summit, SQL Saturday, Power BI world Tour and so forth in Europe, USA, Asia, Australia, and New Zealand. She has over ten years’ experience working with databases and software systems. She was involved in many large-scale projects for big-sized companies. She also AI and Data Platform Microsoft MVP. Leila is an active Technical Microsoft AI blogger for RADACAD.

Leave a Reply