Forum Discussion
Using R in Query Editor
- 7 years ago
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.
- Change the last line.
output$completedValues <- completedData$"SMI missing values"
output$completedValues <- completedData$"SMI.missing.values" - 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 = ",")
- Change the last line.
Do you understand my problem and can you help me?
- v-juanli-msft7 years ago
Community Support
Hi MPereira
I test by following this link and i meet the same problem as you do.
But i'm not familiar with R language, so i'm consulting with senior engineers how to solve this problem.
For any workaround to use R in Power bi, you could refer to other links.
https://docs.microsoft.com/en-us/power-bi/desktop-r-ide
https://docs.microsoft.com/en-us/power-bi/desktop-r-visuals
Best Regards
Maggie
- MPereira7 years agoFrequent Visitor
Hi v-juanli-msft.
Thank you so much for your help and your the senior engineers team!
However, AlexisOlson's response helped me solve the problem!
Thank you again!
- AlexisOlson7 years ago
Super User
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.
- Change the last line.
output$completedValues <- completedData$"SMI missing values"
output$completedValues <- completedData$"SMI.missing.values" - 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 = ",")
- ImkeF7 years ago
Community Champion
It looks as if your simply referencing the wrong field from the table. In the column [Value], click on the "Table" in the first row instead of the second.
- AlexisOlson7 years ago
Super User
ImkeF The output table is supposed to have three columns where the third reads from the second column of completedData.
Neither of those two tables produces the expected output since the column reference is getting messed up in the last line of the R script like I explained above.
- MPereira7 years agoFrequent Visitor
- Change the last line.