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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
sezerunar
Frequent Visitor

Table with R Script

Hi there,

 
I am trying to make a table visual with Rscript.
 
The below is my code:
 
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

# dataset <- data.frame(unique)
# dataset <- unique(dataset)

# Paste or type your script code here:
library(DT)
DT::datatable(dataset)
 
However, it doesn't return any visual. It says "No image was created. The R code didn't result in creation of any visuals. Make sure your R scripts results in a plot to the R default device."
 
I can make ggplot2 visuals, but why not DT table or GT table?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sezerunar ,

 

This error message suggests that the DT::datatable function is not generating a plot. The DT package is designed to create interactive tables in R, but it may not be compatible with Power BI.

 

Please try to use a different package: Instead of , you could use the package to create a table as a static plot. This way, the visual can be rendered as an image in Power BI. 

library(ggplot2)
library(gridExtra)

# Assuming 'dataset' is your data frame
# Create a simple table visual using 'tableGrob' function from 'gridExtra' package
table <- tableGrob(dataset)
grid.draw(table)

This will create a static table visual as an image that Power BI can display.

 

 

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @sezerunar ,

 

This error message suggests that the DT::datatable function is not generating a plot. The DT package is designed to create interactive tables in R, but it may not be compatible with Power BI.

 

Please try to use a different package: Instead of , you could use the package to create a table as a static plot. This way, the visual can be rendered as an image in Power BI. 

library(ggplot2)
library(gridExtra)

# Assuming 'dataset' is your data frame
# Create a simple table visual using 'tableGrob' function from 'gridExtra' package
table <- tableGrob(dataset)
grid.draw(table)

This will create a static table visual as an image that Power BI can display.

 

 

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.