how to load R packages in Power BI [duplicate] - r

I have plotted the graph using a code in R using library function which is part of certain package.
I want to use this code in powerbi to plot the graph. But I am not able to add the package (library function) in power bi?

For a Power BI Desktop scenario, it calls the R Installation specified in the Power BI Options. So you need to add the packages you want via that R Installation.
For an app.powerbi.com scenario, you are limited to the list of packages they support, ref:
https://powerbi.microsoft.com/en-us/documentation/powerbi-service-r-visuals/

Just to clarify, are you trying to install packages or add packages that you already have into R?
Unfortunately Power BI isn't an IDE for the R language, so you will need to install the packages that you want via your R IDE or command prompt.
If you are trying to use packages that are already installed on your machine, for example, the package plotrix, then you can use the R script editor in the Visualisations tab like this:
require(plotrix)
or
library(plotrix)
Please post an update to show if this has helped you. :)

Was just now gone through the same problem: everything was loading fine except the visual created with R which required me to use ggplot2 and it was giving an error saying
there is no package called ggplot2
In order to solve it, opened RStudio and in the console ran
install.packages("ggplot2")
Then, went back to PowerBI and clicked "Atualizar" (which means "Update" in portuguese)
and the visual showed up without any errors.

Related

Trying to load a library

This is my first time using R and I was wondering what to do. I thought I installed these two packages but I got this message after I tried to run the library.
What I see when I try to run the code:

What is the code for hiding install.packages() in R?

Currently I'm calling for install.packages() every time I'm loading a library in R, since my laptop seems to always giving me an error message if I don't do that, but I'm kinda sure that I've already installed those packages while setting up RStudio. Is there a way for me to enter those install.packages() on top of every RMD file and then hide them? I've heard that some code could do it. Thanks a lot!
You don't need to install a package each time. Simply run library(whateverpackage) and that's it. You can always suppressMessages(library(whateverpackage)) You can see currently loaded packages using sessionInfo()

R: Is there a way to get the sessionInfo/packages of other session R?

Imagine that I open two session R.
In the first (R1) I loaded the package dplyr.
Now, my questions is, is there way to get the sessionInfo/packages loaded in R1
through R2??
UPDATE:
I am writing a R help system in Atom editor. Atom editor currently not support the function help of R. So i am creating one. And to find the help of the function you need to search into packages where this function is, the best way is know what packages are loaded in your current session R. And that is my difficult. One way to solution this is to forgett the loaded packages and search in all installed packages, but it is to slowly if you have a lot of packages installed.
So in my script R i have a line that has this code:
pkg <- .packages() # all packages loaded in this currently session
But when I run this script R1 in other script R2, it not get the packages loaded in the currently script R2, but the script R1.
Use the Services API to interact with Hydrogen
The following details interacting with other packages in atom: http://flight-manual.atom.io/behind-atom/sections/interacting-with-other-packages-via-services/
Hydrogen is an interface to a jupyter kernel. It's is maintaining the session with the kernel, and it has a plugin API currently which you could use to get the connection information to the backing kernel. https://nteract.gitbooks.io/hydrogen/docs/PluginAPI.html. Using that you could send your call to packages().
There is also r-exec, but I believe that's Mac only. In that case, you could get the

How to use R packages in Power BI?

I have plotted the graph using a code in R using library function which is part of certain package.
I want to use this code in powerbi to plot the graph. But I am not able to add the package (library function) in power bi?
For a Power BI Desktop scenario, it calls the R Installation specified in the Power BI Options. So you need to add the packages you want via that R Installation.
For an app.powerbi.com scenario, you are limited to the list of packages they support, ref:
https://powerbi.microsoft.com/en-us/documentation/powerbi-service-r-visuals/
Just to clarify, are you trying to install packages or add packages that you already have into R?
Unfortunately Power BI isn't an IDE for the R language, so you will need to install the packages that you want via your R IDE or command prompt.
If you are trying to use packages that are already installed on your machine, for example, the package plotrix, then you can use the R script editor in the Visualisations tab like this:
require(plotrix)
or
library(plotrix)
Please post an update to show if this has helped you. :)
Was just now gone through the same problem: everything was loading fine except the visual created with R which required me to use ggplot2 and it was giving an error saying
there is no package called ggplot2
In order to solve it, opened RStudio and in the console ran
install.packages("ggplot2")
Then, went back to PowerBI and clicked "Atualizar" (which means "Update" in portuguese)
and the visual showed up without any errors.

Can't get madlib.forest_train() in Rstudio by using PivotalR library

I have configured RStudio to run R code natively on Greenplum. I have searched online but I couldn't find answer to the problem I am facing at the moment.
I have imported the library(PivotalR) and library(RPostgreSQL). But, when I type madlib it just comes up with few of the functions:
The Greenplum database has also been configured with Madlib functions including madlib.forest_train, which does not show up in RStudio. I am assuming it has something to do with the PivotalR package for RStudio. Is there a way to make the forest_train work directly from RStudio?

Resources