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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

R Script Error when viewing report on Powerbi.com

I have created a report where I use one simple R-visual. It's a basic correlation plot and it works perfectly when running in Power BI Desktop.

 

But when I have published the report and try to view the R-visual online I get R Script Error and the following error message:

Error in if (min(corr) < -1 - .Machine$double.eps || max(corr) > 1 + .Machine$double.eps) { : missing value where TRUE/FALSE needed In addition: Warning message: package 'corrplot' was built under R version 3.2.4

 

Anyone who knows why this happens or have seen similar issues with their R-visuals?

 

Thanks,

Magnus

1 ACCEPTED SOLUTION
Anonymous
Not applicable

This is actually quite strange... I installed latest version of Microsoft R Open on my machine and was still able to run the visual successfully on my Desktop with same data set.

 

I then examined the data set a little more and I was aware of that some of the columns contained quite many nulls, I thought that shouldn't matter since I stated to use pairwise observations only in the cor function... But when I replaced all nulls with 0 and uploaded the new version to powerbi.com it actually rendered as it should...

 

 

I don't fully understand how the cor function is supposed to handle nulls but in this case it actually makes sense to set null=0 in order to make the data set more logical. And since it then also executes properly i guess I'm happy for now 🙂

 

Interesting to here if Microsoft comes back with some comment on your mail, please update this post if you receive some response.

 

Thanks,

View solution in original post

9 REPLIES 9
Greg_Deckler
Community Champion
Community Champion

My initial guess would be that you are using a function of corrplot that is not supported in version 3.2.4 of R. corrplot is a supported package per this documentation:

 

https://powerbi.microsoft.com/en-us/documentation/powerbi-service-r-visuals/

 

That's a complete guess on my part. You might check that article for any other potential limitations you might be hitting.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

The script I'm using is the simplest of all kinds and full code is:


library(corrplot)

M<- cor(dataset, use="pairwise.complete.obs")
corrplot(M,method="circle")

 

As you say, corrplot is a supported package according to Microsoft and I find it hard to believe that my use of the function should be of any special difficulty for the R-engine  to handle?

 

You have any sample data? I could try to replicate your issue.

 

Just as an aside, I assume this works fine in Desktop and in your R IDE?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks, it would be great to see if it works for you.

 

You can find some sample data here csv file

 

The fields that I use to calculate the correlation is: ActualPrice.2, Fee.1, LandArea.1, Rooms, Size.1 and SupplArea.1

 

And yes, it works fine when I run this in Power BI Desktop 

Well, I replicated it, but in the Desktop!!

 

corrplot.png

 

I should note however that I am using Microsoft's MRO Rgui 3.2.3 64-bit as my R runtime. I am betting that you are using something else and I am further betting that whatever Power BI is running is probably more along the lines of what I am running versus what you are running.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Well then I rest my case... I guess the version that I'm running (some old oracle distribution 3.1.1) might take some "shortcut" when calculating the correlation matrix and therefore is able to create and display the visual in Desktop...

 

I will install a newer distribution of R and try again, my guess is that it then will fail for me as well...

 

Thanks anyway for your help! 

I did send a frown to MS and followed up with an email on how to replicate the issue. They may come back and say "too bad" but worth a shot.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

This is actually quite strange... I installed latest version of Microsoft R Open on my machine and was still able to run the visual successfully on my Desktop with same data set.

 

I then examined the data set a little more and I was aware of that some of the columns contained quite many nulls, I thought that shouldn't matter since I stated to use pairwise observations only in the cor function... But when I replaced all nulls with 0 and uploaded the new version to powerbi.com it actually rendered as it should...

 

 

I don't fully understand how the cor function is supposed to handle nulls but in this case it actually makes sense to set null=0 in order to make the data set more logical. And since it then also executes properly i guess I'm happy for now 🙂

 

Interesting to here if Microsoft comes back with some comment on your mail, please update this post if you receive some response.

 

Thanks,

Sounds like I need to update my MRO!



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.