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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Not able to install R library in PowerBI

Hi, 

 

I am trying to install R library in PowerBI R editor

 

If i write: 

install.packages('mice', lib=.libPaths())
I get error message that
the lib element  C:\Program Files\R\R-3.6.2\library is not a writable directory
 
If i write
install.packages('mice')
I get
 
Error Message:
R script error.
Installing package into 'C:/Users/my name/Library'
(as 'lib' is unspecified)
Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: install.packages -> contrib.url
Execution halted
 
If i write
install.packages("plotrix", lib = "C:/Program Files/R/R-3.6.3/library")
I get the same error message as above.
What should I do???
 
Thanks in advance!
11 REPLIES 11
ImkeF
Super User
Super User

Why do you want to install it via Power BI?

Power BI performs actions that are repeatable (i.e.regular data refreshes) but you'd normally install a package just once.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Is it possible to use library out of Powerbi and still use it in Powerbi? How to do that? When I install library in R studio, it is saved in a temp folder as I can see... and not possible to use it in powerbi...

Change the installation path in R Studio to the path that you've entered in your PBI settings:

 image.png

 

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Do you mean C:\Program Files\R\R-3.6.2\library? But i just found this folder is read only and however i change it to writable, it will be changed back automatically...

Sorry, I might have given the wrong advice here.

My R-libraries are installed in a local folder in the documents-path of my user.

 

I don't understand the details behind it, so hopefully someone else jumps in here.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

hmmm... what do u mean? you mean you R libraries, were downloaded via R studio, saved in a local folder, and you can use them in PowerBI??? How does that work? Where did you save them and how did you let PowerBI know where they are?

Actually, I didn't let Power BI know where they are.

Instead I just "told" R-Studio where they are: 

 

image.png

 

 

 

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

I have exactly the same setting in R studio as you do and in Powerbi options...

 

how come it doesnt work for me? 

 

Did you just write install.packages('name_of_lib') in R script editor in Powerbi? See the initial post, I have tried different combinitions and still doesnt work...

Hi @Anonymous 

I have NEVER installed any package through Power BI.

I'm always using R-Studio to install my packages.

Unfortunately I have no idea why - if you also intall your packages through R-Studio- Power BI would not recognize them.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

I followed this post, but when I finish step 5, a new R studio session will be opened for me, but it is totally blank and does not carry any variable from Powerbi into it... 

 

https://docs.microsoft.com/en-us/power-bi/desktop-r-ide

Hi @Anonymous 

I'm not using this functionality, so cannot give any tips on that, unfortunately.

 

.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.