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
moralescas
Frequent Visitor

Using an .Rds file in power BI

Dear community,

 

I am creating a map in my Power Bi report using R visuals. The library(sp) to be precise.

 

To create the map I am interested in, I need a SpatialPolygonsDataFrame that I can easily find online as an .rds file.

 

When creating the R visual, I need to have this data frame ready for usage. However, in the query process, it is not possible for me to extract something like an .rds file. 

For this reason, I extract the .rds file directly from R visual script editor, using something along the lines of

 

# get spatial data for country
con <- 
url("https:/.../countrySpatialData.rds")

 

spatialDataFrame <- readRDS(con)


It works like a charm! But at the time of seeing the report already published, I encounter the following error:

 

Script Runtime Error
Error in readRDS(con) : cannot open the connection In addition: Warning message: In readRDS(con) : InternetOpenUrl failed: 'The server name or address could not be resolved'

 

My assumption is that PowerBI app does not allow me to stablish a connection using the R visual script runner.

Does anyone have an idea as to how to access .rds files using the R visual script runner?

Thank you in advance

Paulo

p.s. I have come across this post already https://community.powerbi.com/t5/Desktop/load-R-rds-file-within-R-visual-in-PBI-service/m-p/506305#M... , but it unfortunately does not solve the problem.

 

1 REPLY 1
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi Paulo,

 

I would suggest you split it into two steps. One is getting data and another is creating a visual.

1. Get data with R script in the Query Editor.

2. Create a visual.

Using_an_Rds_file_in_power_BI

 

Best Regards,
Dale

Community Support Team _ Dale
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 Fabric 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.