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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MPereira
Frequent Visitor

Using R in Query Editor

Hello experts,

I need to understand how to run an R script in Power BI and I found the link desktop-r-in-query-editor.

At first the script did not work, until I found the post Error-in-running-an-R-script-in-Power-Query. The error stopped happening, however the CompletedValues column did not appear in my fields panel.
 
Captura de Tela 2018-12-26 às 13.59.46.png
 
Captura de Tela 2018-12-26 às 14.00.02.png
 
Captura de Tela 2018-12-26 às 14.00.13.png
 
Anyone have any idea what might be happening?
 
I downloaded the final .pbix file provided by the article, but the same problem occurs!
 
Please, help me.
 
Best regards,
 
Marcelo.
1 ACCEPTED SOLUTION

To me it looks like you aren't referencing the missing values column of completedData correctly.

 

When you load the data using dataset <-read.csv, by default it replaces the spaces within column names with periods. In particular, "SMI missing values" becomes "SMI.missing.values" so the last step in the R script doesn't do anything since it refers to a nonexistant column.

 

There are two easy fixes. Pick one or the other but not both.

 

  1. Change the last line.
    output$completedValues <- completedData$"SMI missing values"
    output$completedValues <- completedData$"SMI.missing.values"
  2. Add an argument to read.csv to prevent this replacement.
    dataset <- read.csv (file = "<path>", header = TRUE, sep = ",")
    dataset <- read.csv (file = "<path>", header = TRUE, check.names=FALSE, sep = ",")

 

 

View solution in original post

10 REPLIES 10

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.