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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors