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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Data Tree R Code working in Rstudio but not in PowerBI..Please help

hello all,

 

I am trying to create a R visual in powerbi.

 

R code which is working fine in Rstudio is

 

 

Data <- read_excel(path = "D:\\Book1.xlsx",sheet = "Sheet4")

Data$pathString <- paste("name", 
                         Data$Level1, 
                         Data$Level2, 
                         Data$Level3,
                         Data$Level4,
                         Data$Level5,
                         Data$Level6,
                         sep = "/")


library(data.tree)
Network <- as.Node(Data)

plot(Network)

 

and it is giving me output a visual as below image

 

Capture.PNG

 

But when i try the same code in powerbi it is not working.

Capture1.PNG

 

Capture2.PNG

 

 

But when i clicked EDIT IN EXTERNEL R IDE it worked perfectly.

 

This is for the first time that im trying to create R visuals in powerbi.

 

Can anyone please suggest me about this.

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I got it to work.  Here's an example of how to get it to render:

library(DiagrammeR)
library(DiagrammeRsvg)
library(magrittr)
library(svglite)
library(rsvg)
library(png)
library(data.tree)

Type <- c('Car','Car','Car','Car')
Manufacturer <- c('Chevrolet', 'Chevrolet', 'Honda', 'Toyota')
Model <- c('Impala', 'Silverado', 'CR-V', 'Camery')
          
dataset<- data.frame(Type, Manufacturer, Model, stringsAsFactors=FALSE)

dataset$pathString <- paste(dataset$Type, dataset$Manufacturer, dataset$Model,sep = "/")
tree <- as.Node(dataset)

export_svg(plot(tree))%>%charToRaw %>% rsvg %>% png::writePNG('001.png')

 

 

The last part is how you export it manually to a .png, which power BI seems to be looking for.

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

I got it to work.  Here's an example of how to get it to render:

library(DiagrammeR)
library(DiagrammeRsvg)
library(magrittr)
library(svglite)
library(rsvg)
library(png)
library(data.tree)

Type <- c('Car','Car','Car','Car')
Manufacturer <- c('Chevrolet', 'Chevrolet', 'Honda', 'Toyota')
Model <- c('Impala', 'Silverado', 'CR-V', 'Camery')
          
dataset<- data.frame(Type, Manufacturer, Model, stringsAsFactors=FALSE)

dataset$pathString <- paste(dataset$Type, dataset$Manufacturer, dataset$Model,sep = "/")
tree <- as.Node(dataset)

export_svg(plot(tree))%>%charToRaw %>% rsvg %>% png::writePNG('001.png')

 

 

The last part is how you export it manually to a .png, which power BI seems to be looking for.

 

Anonymous
Not applicable

Hi, thanks to the workaround provided.

We use it and managed partialy to resolve the visualization problem.

 

However, once report is published into Power BI Service it throws an error that not all libraries used in a visual are supported.

Have you faced the same problem?

Any ideas how it can be resolved?

 

Thanks!

Anonymous
Not applicable

I am having the exact same problem.  Downloaded and installed the older version (0.7.0) of data.tree. Still does not work.  Works fine in R studio.

 

This would be extremely helpful in a project I'm working on, but I'm about ready to give up...

 

 

v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may check Requirements and Limitations of R packages.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-chuncz-msft thanks for the reply.

 

I jus checekd the link that you have provided.

 

I dont see any limitations for the Data tree package..

 

and i dont see any perticular limitations which the funtions and packages that i have used

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.