I built a Power BI report page with some R visuals (by using ggplot and scale etc.). The visuals display well on power bi desktop, but after being published to my workspace on power bi service, the R scripted visuals all have runtime error:
Error in label_number(prefix = "$", suffix = "M", scale = 1e-06, big.mark = ",") :
could not find function "label_number"
Below are the codes I wrote for one of the visuals
# dataset <- data.frame(Project #, Name, Portfolio, OC, Hours, Cost)
# dataset <- unique(dataset)
# Paste or type your script code here:
library(tidyverse)
library(readxl)
library (dplyr)
library(tidyr)
library(lubridate)
library(ggplot2)
library(scales)
library(ggrepel)
plot1 <- dataset %>%
ggplot(mapping = aes(x = Cost, y = OC, size = Cost, label = Name ), varwith = TRUE )+
geom_point() +
geom_smooth () +
scale_x_continuous (labels = label_number(prefix = "$", suffix = "M", scale = 0.000001, big.mark = ",")) +
scale_y_continuous(labels = label_number(prefix = "$", suffix = "M", scale = 0.000001, big.mark = ","))+
scale_size_continuous (labels = label_number(prefix = "$", suffix = "M", scale = 0.000001, big.mark = ",")) +
geom_text_repel(box.padding = 0.3, point.padding = 0.3, size = 3)+
labs(x = "Project Cost", y = "Owners Cost") +
theme (legend.position = "bottom")
plot1
Appreciate any help in advance! visual displayed on power bi desktop with the codes error message after being published
Google searched but could not find any resource related to this specific problem.