first steps of R visual in Power BI - r

I'm just starting to use R visuals in Power BI, but I can't get it working
Whatever code I try I get this error:
error: could not find function "dir.exists"
Sample code:
As I don't use dir.exists, it seems somehow R can't even be started, however it seems it's set up properly:
RStudio is installed on my pc and it's running properly
I've just downloaded sample .pbix from Microsoft (https://learn.microsoft.com/en-us/power-bi/visuals/service-r-visuals) and it has the exact same error.

dir.exists was introduced in R 3.2 https://cran.r-project.org/bin/windows/base/old/3.2.0/NEWS.R-3.2.0.html
New function dir.exists() in package base to test efficiently whether one or more paths exist and are directories.
Consider upgrading to a more recent version of R.
I would recommend either current R from CRAN (4.0 at the time of this writing), or Microsoft R 3.4.4 to match the runtime in PowerBI Service https://learn.microsoft.com/en-us/power-bi/connect-data/service-r-packages-support
Current R runtime: Microsoft R 3.4.4
R from CRAN can be found at https://cran.r-project.org/ .
Microsoft R 3.4.4 can be found at https://cran.microsoft.com/bin/windows/base/old/3.4.4/
(edit 2021-02: now I'm in doubt, this seems to be R from CRAN as well. See https://mran.microsoft.com/release-history for previous versions of Microsoft R)

Related

R not loading packages on some MAC versions

I am using the regular R console on a MAC Air with Monterrey as the OS and I'm still having issues loading packages. It is iffy, as to whether a package is loaded and ready to use. Sometimes packages will load and sometimes not. Also, it would not call up data sets that as a default are included in the R packages I'm trying to use. the weird thing is it would recognize the example dataset that is included because when I first tied to call them up, it would let me autocomplete the name. Then it stopped doing that. Then it started telling me that the file doesn't exist. I know I haven't used R in a while but this just seems buggy! any help would be appreciated.
The R version that I have installed is : R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics" and it was installed just last week.
It seems R was not properly installed on your machine.
Several persons reported that using the package manager in RStudio actually did the trick of updating the packages.

RevoScaleR package for Microsoft R Open 3.5.3

I've tried to install the RevoScaleR package within Microsoft R Open 3.5.3 but I get the message
"package ‘RevoScaleR’ is not available (for R version 3.5.3)"
which I suppose is clear enough. Is there any way around this? Or will I just have to drop back to an earlier version of MRO to get it to work? I need to use the rxGlm() function because the standard glm() function won't cope with the data I'm working with (size and complexity).
Thanks
Microsoft R Open does not include the proprietary R libraries. You can get these for free by using Microsoft R Client instead, which is Microsoft R Open with the addition of RevoScaleR built in. This package is not open source and cannot be installed into a regular R installation.
You can read more about the Client version: https://learn.microsoft.com/en-us/machine-learning-server/r-client/what-is-microsoft-r-client

How to easily switch R versions on rstudio ubuntu based?

I need to install a package that gives the following error so I am looking for a solution to that. The first approach is looking at ways to chose the right R version.
Should I spend some more time on this or there are other approaches to overcome this issue?
For this package you need R (≥ 3.5.0), so R 3.4.4 is not sufficient for standard installation.
Check on the cran website of the package for further information.
For upgrading R on ubuntu check here (old link!)
Edit: wibeasley mentioned a new link in the commentary for updating R 3.5.0 on Ubuntu.
Check the new link

Caret package in Microsoft Azure ML

I want to load caret library in Azure ML. This works when R version is set to be CRAN R 3.1.0, but on Microsoft R Open 3.2.2 won't work. I must use R Open version because of the other packages that I'm using in my project, which are not supported in that earlier version 3.1.0.
Therefore, the question is how to load this library on ML Azure using Microsoft R Open 3.2.2?
Thanks!
From one of your comments above, it sounds like the version of the caret package you've used requires an R version >3.1.2. I recommend using an older version of the package: the caret binary from this 3.1 archive (6.0-68) worked for me. I used these statements to load the package:
install.packages("src/caret_6.0-68.zip", lib=".", repos= NULL, verbose=TRUE)
library("caret", lib.loc=".", verbose=TRUE)
The caret package is now pre-installed on Azure ML Studio: https://learn.microsoft.com/en-us/azure/machine-learning/studio-module-reference/r-packages-supported-by-azure-machine-learning#bkmk_C
Regards,
Jaya
You can upload the R library you want as a zip file and you refer that within the code. Here's a nice step by step reference from MSDN explaining the process of adding a R library for the experiment.
https://blogs.msdn.microsoft.com/benjguin/2014/09/24/how-to-upload-an-r-package-to-azure-machine-learning/

R install package RevoScaleR

In trying to install package "RevoScaleR", I get the following error. I have tried installing this package with various versions of R but get the same error every time. Does anyone have any idea why?
install.packages("RevoScaleR")
Warning in install.packages :
package ‘RevoScaleR’ is not available (for R version 3.1.2)
Any help is appreciated.
Just to update this post,to install the RevoScaleR package you need to install Microsoft R client, see here for details:
https://www.blue-granite.com/tutorials/sql-server-r-services
R Client includes the ScaleR (rx[…]) functions in the RevoScaleR package. I don't believe this package is open source so isn't available on cran, install.packages() therefore won't work.
The RevoScaleR package is only available if you install the Microsoft R Client or if you use Microsoft RStudio Server via Azure. After you install this you don't need to do install.packages("RevoScaleR") for it is already installed.
R Studio will automatically have the R version [64-bit] C:\Program Files\Microsoft\R Client\R_SERVER under "Global options"
The link below gives more detail information about Microsoft R client. Once you install Ms R client and update the R-studio path to the R client you don't need to install 'RevoScaleR' anymore, it comes pre-installed with Microsoft R client. Read the link fore more.
https://msdn.microsoft.com/en-us/microsoft-r/r-client-get-started
I am not sure what R version you are currently using but the latest stable version is 3.1.2. If the package installation warning is telling that the package you're trying to install is not available, that basically means that the package developer has not yet made a version of the package that is compatible with the R version you're currently running.
If you really need to use this package (if your work heavily depends on it and you are on some kind of deadline) I would advise to install an earlier version of R (like 3.1.1 or 3.1) and do your work with it.
I would also suggest that you reach out to Revolution Analytics, as suggested by Andrie.
Thanks!
You just have to set the propper CRAN repos:
options("repos" = c(CRAN = "https://mran.microsoft.com/"))
and then
install.packages("RevoScaleR")
will run properly.

Resources