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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

R visual - NetworkD3 package

Hi,

 

I need the sankey visual from this package cause the one of Power BI isn't adequate for my task but I struggle and I don't know why ...

 

So basically, I import this R code to load my data:

nodes <- read.table("C:/nodes.txt",header=TRUE)
links <- read.table("C:/links.txt",header=TRUE,sep=",")
data <- merge(nodes,links)

So here, I basically merge those two tables to trick Power BI (cause he can only load one dataframe, I basically do it before him by merging and having all information I need)

 

Then, I use the R visual and put my code into it, this code:

 

# dataset <- data.frame(name, volume, target, source)
# dataset <- unique(dataset)

library(networkD3)
links <- unique(dataset[c("source","target","volume")])
nodes <- unique(dataset[c("name")])
networkD3::sankeyNetwork(Links = links, Nodes = nodes,
Source = 'source',
Target = 'target',
Value = 'volume',
NodeID = 'name')

 

But Power BI says that my code doesnt create any image. I know my dataset preparation is good because i can do a histogram easily but I can't have sankey image from it and I don't know why since this is a package supported by Power BI ?

 

What I suspect is that since this sankey function produces an HTML output, maybe that's why it doesn't work on Power BI ?

 

Best regards,

 

Morgan

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

I think this should more related to R script security, current power bi service not allow your to direct user r script code to invoke external datasource.(these operations works on desktop side)


Please take a look at following document to know more about this limitation:

Creating R visuals in the Power BI service

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.