Forum Discussion
R script visual doesn't want to load in services
I have created an R script visual. It works fine in my desktop version of Power BI. Unfortunatly, after publishing my report online the R visual script won't load in my brower. The R script visual doesn't give an error. It just stop loading after a short time and remains white.
I have only used packages that are support by R, namely "lattice" and "reshape". This is the first time that I'm using R I don't completely understand it yet.
This is the R code that I'm using:
### loading packages
if (!require("lattice")) {
install.packages("lattice", dependencies = TRUE)
library(lattice)
}
if (!require("reshape")) {
install.packages("reshape", dependencies = TRUE)
library("reshape")
}
my_palette <- colorRampPalette(c("red","yellow","green4"))(n = 3000)
aggdata <-aggregate(dataset, by=list(dataset$f_Y2,dataset$r_Y2),
FUN=mean, na.rm=TRUE)
format <- cast(aggdata, Group.1 ~ Group.2)
rowcolNames2 <- list(as.character(1:8), as.character(1:8))
rownames(format) <- format$Group.1
format$Group.1 <- NULL
RFM_matrix <- data.matrix(format)
# 1) Air Passengers #1
plot(1,1)
print(levelplot(RFM_matrix,
col.regions=my_palette,
xlab = "freqentie",
ylab = "recency",
main=" "))
title(main="Churn rate", line=3,adj=0.96)
Does anybody know what could be wrong?
6 Replies
- Greg_Deckler
Community Champion
I would submit this as a support issue. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".
- v-jiascu-msft
Microsoft Employee
Hi Bram,
Can you run the script in the R console? Can you share a sample please? I tested it. I got some errors in the R console while it was fine in the Desktop. Maybe you need to check the codes.
Best Regards,
Dale
- BramRegular Visitor
Hello
Thank you for your help. I'm new to R and I don't really understand what you mean with "running the script in the R console". Is it the same as running the script in R studio? In R studio it runs normal, it just prints out the heatmap, :/.
- v-jiascu-msft
Microsoft Employee
Hi Bram,
Yes, R console is one part of the R studio where you run the script. Can you share a dummy sample of the dataset? BTW, filing a support ticket is also a good idea.
Best Regards,
Dale