The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Exporting A Graph From The Execute R Script Operator
TobiasNehrig
Member Posts: 41 Maven
Hi Experts,
I would like to create a graph with a R-script and export it. The script and the export are working in R-Studio.
But I don't get anything in Rapidminer, is there a way to create a graph with the Execute R Script Operator, display the graph and export it?
<?xml version="1.0" encoding="UTF-8"?><process version="8.2.001">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="8.2.001" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="r_scripting:execute_r" compatibility="8.1.000" expanded="true" height="82" name="Execute R" width="90" x="313" y="34">
<parameter key="script" value="rm_main = function(data) { library(igraph) #setwd ('./home/knecht') g <- graph.empty(5, directed = FALSE) new_edges <- c(1,3, 1,5, 2,5, 4,5) g<- add.edges(g, new_edges) pdf("graph1010.pdf") plot(g) g <-add.vertices(g,1) g <-add.edges(g, c(6,5)) V(g)$name <- letters[1:vcount(g)] E(g)$weight <- runif(ecount(g)) get.adjacency(g, attr = "weight") print(g) return (g) } "/>
</operator>
<connect from_op="Execute R" from_port="output 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
Best regards
Tobias
Tagged:
0
Answers
@TobiasNehrig while not exactly what you're looking for, you can see how to export the image file from the sample file I share here: http://www.neuralmarkettrends.com/wordclouds-rapidminer-r/
@Thomas_Ott
I'd like to create a co-oocuurence graph and I've two approaches. Approach one works with the FP-Growth operator. In this approach i've problems to create the graph with R. And my second approach base on an R-Scrip, which calculate the co-occurrence and it should create the graph. But after calculating the co-occurrence it seems the script runs infinity.
Approach one:
Approach two:
- Using script create plot, write to in-memory image.
- Change in-memory image into BASE64.
- Turn into macro
- Paste the base64 macro as a datauri into a RM Create HTML operator.
- Show in Server (or write HTML to disk).
Can't exactly recall which R libraries were used, so will need to dig them out. I'm sure there's better methods, but this is pretty solid.
@JEdward
thank you, that would be nice.
Best regards Tobias
Hi @Thomas_Ott
thank you for your link, it seems that I had a wrong path for my target file. So now I can plot a graph from RapidMiner.
Best regards
Tobias