Forum Discussion
eliasrs
6 years agoNew Member
R Script error in Power BI but not on RStudio
Hello all. Im trying to create an R Visual to plot a control chart within Power BI. The script has been validated and runs on Rstudio (launched from power BI) but when I run it in Power BI I get th...
- 6 years agoHi,
The dataset dataframe is created automatically by Power BI, thus you don't need the following line of code:
dataset <- data.frame(TestDate, Meas)
If you can share the data or the pbix, perhaps I could be more helpful.
webportal
6 years agoImpactful Individual
Can you try this code:
library(qcc)
qcc(dataset["Meas"], type="xbar.one",nsigmas=3, labels=dataset["TestDate"])
library(qcc)
qcc(dataset["Meas"], type="xbar.one",nsigmas=3, labels=dataset["TestDate"])
- eliasrs6 years agoNew Member
Thanks for the susggestion but it didn't work
It actualy throws the error on the following line
dataset <- data.frame(TestDate, Meas) can't find object TestDate.So, the dataset creation is not working.I tried to adapat to DAX format (Q325[TestDate]) but id did not work.- webportal6 years agoImpactful IndividualHi,
The dataset dataframe is created automatically by Power BI, thus you don't need the following line of code:
dataset <- data.frame(TestDate, Meas)
If you can share the data or the pbix, perhaps I could be more helpful.- eliasrs6 years agoNew Member
Well, just commented the extra line idicated and it worked! this was the end script.
# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:dataset <- unique(dataset)library(qcc)newdata <- dataset[order(dataset$TestDate),]x <- c(newdata$TestDate)s <- c(newdata$Meas)qcc(s, type="xbar.one",nsigmas=3, labels=x)Thanks a lot.