Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

0

Power BI not recognizing all R Script Parameters

Hey there guys. 

 

I'm trying to make my own R Script to use with Power BI, and I am able to import the data and even generate the basic graph.  I am using the iGraph library and am attempting to create a network.  The issue is that I am not able to pass a column of edge (link) colors as a parameter; in R Studio I could do this and it worked just fine.  For some reason, although I can pass the edge widths as a parameter, when I try to do the same with edge colors specifically in the Power BI editor it does not work.  It just assigns arbitrary colors to the links.  I would really appreciate help or guidance on this issue. Here is my code: 

 

library(igraph)

test.edges <- data.frame(dataset$Source, dataset$Destination)
set.seed(12)
graph.2 <- graph_from_data_frame(d = test.edges, directed = TRUE)
par(mar=c(0,0,0,0)+.1)
plot(graph.2, edge.curved = .2, edge.width = (dataset$Count/(.4*mean(dataset$Count))), vertex.label.color = "Black", edge.color = dataset$EColor, vertex.color = "#82ff90")

The issue is with the line "edge.color = dataset$EColor". Again, this line works exactly as intended in R Studio, but not in Power BI. No idea what's going on. Thanks in advance! 

Status: Delivered
Comments
v-haibl-msft
Employee

@pseiler

 

I’ve reported it internally to Power BI Team: CRI 42351398
I’ll post here once I get any update about it.

 

Best Regards,
Herbert

Vicky_Song
Impactful Individual
Status changed to: Accepted
 
pseiler
Regular Visitor

Thank you guys for your help. I really appreciate it and I hope this issue gets resolved soon!

v-haibl-msft
Employee

@pseiler

 

Please wrap the supplied "dataset$EColor" parameter with toString, this means that plot should look like this: 

plot(graph.2, edge.curved = .2, edge.width = (dataset$Count/(.4*mean(dataset$Count))), vertex.label.color = "Black", edge.color = toString(dataset$EColor), vertex.color = "#82ff90")

This should work fine in Power BI.

 

Best Regards,
Herbert

pseiler
Regular Visitor

It worked. You're a life saver Herbert! Thank you so much. Do you happen to know why it was working in R Studio but not in Power BI? (simply for my curiosity at this point)

v-haibl-msft
Employee

@pseiler

 

I did not get the reason why it was not working in PBI. Maybe it is a limitation in current version of PBI. The good news is that we can currently use the simple workaround as a mitigation.

 

Best Regards,
Herbert

Vicky_Song
Impactful Individual
Status changed to: Delivered
 
pseiler
Regular Visitor

Got it. Thank you!