- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Data modeling: R script error in Power Bi
Hello,
I try to run a simple regression script in Power BI but I get this message in Power BI:
DataSource.Error: ADO.NET: R script error. Error in eval(predvars, data, env) : object 'price' not found Calls: lm ... eval -> -> model.frame.default -> eval -> eval Execution halted Details: DataSourceKind=R DataSourcePath=R Message=R script error. Error in eval(predvars, data, env) : object 'price' not found Calls: lm ... eval -> -> model.frame.default -> eval -> eval Execution halted ErrorCode=-2147467259 ExceptionType=Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException
This simple regression script runs well in R Studio. What's wrong? Any idea?
Please find below the raw data.
Many thanks
price | engine-size | horsepower |
13495 | 130 | 111 |
16500 | 130 | 111 |
16500 | 152 | 154 |
13950 | 109 | 102 |
17450 | 136 | 115 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Qmars007,
You can modify your R script below:
Regression <- lm(price ~ horsepower + enginesize, data=dataset) #Show the results summary(Regression) with(dataset,plot(horsepower,enginesize)) abline(Regression)
Best Regards,
Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Qiuyun,
Thanks for your reply and suggestions. I was wondering with summary (regression) script, shouldn't I see the coefficients of the model in Power BI as below:
Residuals:
Min 1Q Median 3Q Max
-11180 -1908 -201 1629 13277
Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) -8510.47 843.84 -10.085 < 2e-16 ***
horsepower 60.21 12.24 4.917 1.85e-06 ***
enginesize 122.44 11.01 11.118 < 2e-16 ***
----
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3678 on 196 degrees of freedom
Multiple R-squared: 0.7896, Adjusted R-squared: 0.7875
F-statistic: 367.8 on 2 and 196 DF, p-value: < 2.2e-16
-----------------------------------------------------------------
If that is not feasable in Power BI please let me know
Best
Qmars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Qmars007,
The summary (regression) result you mention is returned in R studio Console pane not in Plots pane. You need to ensure the result can be plot in Plots pane in R studio, then you can use the R script in Power BI to visualize data. For example, in my previous post, I use abline() to plot a chart.
Best Regards,
Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Qiuyuan,
Thanks for your prompt response.
My aim is to display the summary of my regression analysis in Power BI as it does appear in R studio pane rather than the graph of the correlation between the two explanatory variables.
How can this be done?
Thanks very much
Qmars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Qmars007,
Till now, it's almost the R issue instead of Power BI visual. As I mentioned before, you might need to write R script to ensure Summary(regression) result display in Plots pane within R studio. Then you can use the same script in Power BI desktop to plot the visual.
Best Regards,
Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Qmars007,
Would you please share the R script?
If possible, please share pbix file as well. You can upload it to your OneDrive and send the share link to me via private message.
Best Regards,
Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
02-09-2024 02:25 AM | |||
09-08-2023 04:24 AM | |||
07-01-2024 08:35 AM | |||
05-26-2024 08:54 PM | |||
01-02-2024 09:55 AM |
User | Count |
---|---|
87 | |
81 | |
53 | |
38 | |
35 |