Debugging Power Bi R Custom Visual Using R studio
Are you developing a R custom visual for Power Bi and got fed up in the debugging process, here is the one easy way to debug your R visual in R Studio.
Add the following code to the top of you sript.r file
You can also find the below code in this gist https://gist.github.com/praveenn-vbi/1c92ca338845f9a2367a33b83b698458
#DEBUG in RStudio
fileRda=”C:/temp/Data.Rda”
if(file.exists(dirname(fileRda))){
if(Sys.getenv(“RSTUDIO”)!=””)
load(file= fileRda)
else
save(list = ls(all.names = TRUE), file=fileRda)
}
Now package your R visual and import the packaged R visual into you Power Bi Destop App. Assign the data to your R visual.
Now you can find Data.Rda file in C:/temp as we metioned in the above.
Now open the Data.Rda file in RStudio. The data you set to your custom visual will get imported to R your session variables.
That’s it, now you can directly open your script.R file in your R Studio and debugg it.
My twitter id @np_hinata
And always thanks for your time.
Praveen N
யாதும் ஊரே யாவரும் கேளிர்