How to visualize charts in Visual Studio and Azure ML through R script? -


i have seen on various examples (even in azure ml) able create appealing charts using r in visual studio (not r studio!), have no clue how did it. experienced r, if point me in right direction of how visualize data sets in visual studio , azure ml; appreciate it. here example duplicate (in both azure ml , visual studio): visual studio chart

image source: https://regmedia.co.uk/2016/03/09/r_vis_studio_plot.jpg?x=648&y=348&crop=1

you can install ggplot2 in solution in visual studio extension open r (https://www.visualstudio.com/en-us/features/rtvs-vs.aspx) through line of code , visualize within r plot window in visual studio after creating r-project:

install.packages('ggplot2', dep = true)  library(ggplot2) 

the reason have «library(ggplot2)» check if package got installed, else error this: error in library(ggplot2) : there no package called ‘ggplot2’

so if don’t error; should go.

for question how output charts; have populate ggplot2 charts datasource, in example below (csv-file):

dataset1 <- read.csv("adult census income binary classification dataset.csv", header = true, sep = ",", quote = "", fill = true, comment.char = "")  head(dataset1)  install.packages('ggplot2', dep = true)  library(ggplot2)  names(dataset1) <- sub(pattern = ',', replacement = '.', x = names(dataset1))  foo = qplot(age, data = dataset1, geom = "histogram", fill = income, position = "dodge");  print(foo)  bar = qplot(age, data = dataset1, geom = "density", alpha = 1, fill = income);  print(bar) 

here can see create 2 charts, 1 histogram , 1 density-chart.

enter image description here

in azure ml, same charts (this time included histogram relationships well), this:

// map 1-based optional input ports variables  dataset1 <- maml.mapinputport(1) # class: data.frame  library(ggplot2)  library(data.table)  names(dataset1) <- sub(pattern=',', replacement='.', x=names(dataset1))  // time need specify x sex; didn’t need in visual studio  foo = qplot(x=sex, data=dataset1, geom="histogram", fill=income, position="dodge");  print(foo)  foo = qplot(x=relationship, data=dataset1, geom="histogram", fill=income, position="dodge");  print(foo)  foo = qplot(x=age, data=dataset1, geom="density", alpha=0.5, fill=income);  print(foo)  // select data.frame sent output dataset port maml.mapoutputport("dataset1"); 

remember put of in “execute r script module” in order run correctly. after that, can right lick module , visualize result.

enter image description here