Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
heyydrien
Regular Visitor

how to load R packages

I'd like to create an R visual but Power BI can't seem to locate the ggplot2 package: "R script error. Error in library(ggplot2) : there is no package called 'ggplot2'". The ggplot2 is already installed and loaded in my R environment. In addition, my R home directory is set in Power BI and I've already created basic R plots that do not require additional packages. In the R script editor, I've also tried replacing "library(ggplot2)" with "library("ggplot2", lib.loc="C:/path-to-my-r-packages")" but no success so far. Any tips you have would be greatly appreciated!

 

1 REPLY 1
Anonymous
Not applicable

Hi @heyydrien,

 

Maybe you can try to setting the full path of r script in options:

7.PNG

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.