Forum Discussion

arajani40's avatar
arajani40
Regular Visitor
4 years ago
Solved

Power BI Service R Script Runtime error

Hi Support, my R visual created some time back was running absolutely fine till last week but noticed that it is giving an error with the below details now:

 

Activity ID: 06a8c3e2-1bdd-444e-830b-12b1942c2594
Request ID: 374c2c5f-bcc3-064f-4fa7-e464f1f63f03
Correlation ID: 4da864bd-0050-cdcf-e05e-6e4622650cd7
Time: Wed Apr 20 2022 14:15:48 GMT+1000 (Australian Eastern Standard Time)
Service version: 13.0.18082.40
Client version: 2204.2.10821-train
Cluster URI: https://wabi-australia-east-a-primary-redirect.analysis.windows.net/

 

Rscript from PowerBi Desktop:

library(ggplot2)
library(stringr)
library(tidyverse)
library(dplyr)

dataset$Category<-factor(dataset$Category,levels=c("Formal education","External and internal short courses","Technical conferences and learned society meetings","Publications","On-the-job skill enhancement","Private reading of learned publications","Structured mentoring","Service to industry","Peer reviewing","Other activities"))
dataset<-mutate(dataset,Eligible_Hours=ifelse(Total_Hours<=Maximum_Hours,Total_Hours,Maximum_Hours))
dataset<-mutate(dataset,Excess_Hours=ifelse(Total_Hours>Maximum_Hours,Total_Hours-Maximum_Hours,0))
df<-gather(dataset,"HoursType","Hours",3:5)
df<-filter(df,HoursType!="Maximum_Hours")
g<-ggplot(data=df,aes(x=Category,y=Hours,fill=HoursType))+
geom_col(stat="identity",width=0.5,position=position_stack(reverse=T))+
scale_fill_manual(values=c("#005E85","#CBDBE5"))+
#geom_col(aes(y=Eligible_Hours),fill="#00AAC3")+
scale_x_discrete(labels = function(x) str_wrap(x, width = 15))+
geom_text(aes(label=ifelse(HoursType=="Eligible_Hours", Hours,"")),position=position_dodge(0.1),vjust=-0.5,size=5)+
theme_minimal()+
theme(legend.position="top",axis.text=element_text(size=14),
axis.title=element_text(size=14,face="bold"))+labs(fill="")
g
 
Request you to please help. Thanks!
  • I believe I have a very simlar issue. It would appear that something has changed in the way that PowerBI handles R visuals when published. Having now rebuilt my visual, it now works on the desktop but not when published. Have recreated the visual and tried tweaking a few different things (librarys, syntax etc), I've updated to the latest version of desktop and run a full update of R and RStudio on my machine, however, I'm still getting the same unhelpful syntax error.

4 Replies

  • MatBaker's avatar
    MatBaker
    Frequent Visitor

    I believe I have a very simlar issue. It would appear that something has changed in the way that PowerBI handles R visuals when published. Having now rebuilt my visual, it now works on the desktop but not when published. Have recreated the visual and tried tweaking a few different things (librarys, syntax etc), I've updated to the latest version of desktop and run a full update of R and RStudio on my machine, however, I'm still getting the same unhelpful syntax error.

  • Anonymous's avatar
    Anonymous
    Not applicable

    I have exactly the same issue. The visual runs fine in the desktop version, but it fails when is published to the web service (Runtime error). I double checked, and it has no conflict with the packages (Im using ggplot and dplyr).