PowerBI Desktop and R Error: package or namespace load failed for 'ggplot2' - r

I'm really stuck and need some help.
After installing R 3.5.1, I'm getting this error message on R visualizations in Power BI Desktop which were previously working
"Error: package or namespace load failed for 'ggplot2': package
'scales' was installed by an R version with different internals; it
needs to be reinstalled for use with this R version."
I already tried to:
reinstall R 3.5.1
reinstall RStudio
reinstall ggplot2 and scales package
reinstall all packages
reinstall Power BI Desktop
Still it does not work.
Considerations:
My visualizations were working well before I installed R 3.5.1
My visualizations are working well on other PCs
When I run the code on RStudio I don't get any error
Any thoughts?

I would try running this inside your visual:
.libPath()
library(ggplot2)
It will give you an error message but there should be the output of .libPath() as well, looking like:
[1] "C:/Users/.../Documents/R/win-library/3.4"
[2] "C:/Program Files/R/R-3.4.3/library"
and then I would try to install (or copy an existing folder) ggplot into one of those directories.

Related

Install R packages problem using RStudio Package Manager

I tried to install R packages using RStudio Package Manager using the following code:
install.packages("dplyr", type = "source")
and
install.packages("dplyr")
and it gives the following error:
Error in install.packages : invalid version specification 'r56550'
What should I do? I tried to google the error but nothing comes up. I have tried to delete and reinstall R and RStudio but i still received the error. I tried to download both the existing binary and the source file and neither ways worked. I tried to install different packages and repeated in both R and Rstudio and nothing worked.
Thank you!
Update 1: I'm using R version 4.0.5 and RStudio version 1.4.1106. I have also downloaded Rtools40 according to the instruction in the following website: https://cran.r-project.org/bin/windows/Rtools/. I'm using Windows. By 'R Manager' I meant the package manager console in RStudio.
Update 2: I'm not sure if there is no network issue or proxy. If I download the packages directly through the CRAN mirror, then it works. But we are trying to download packages in an offline environment, that's why I need RStudio Package Manager.

Error: package or namespace load failed for 'ggplot2': package 'ggplot2' was installed before R 4.0.0: please re-install it Execution halted

I'm really stuck and need some help.
After installing R 4.0.2, I'm getting this error message on R visualizations in Power BI Desktop which were previously working
"Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it.
Execution halted"
I already tried to:
reinstall R 4.0.2
reinstall RStudio
reinstall ggplot2
reinstall all packages
reinstall Power BI Desktop. My version is August-2020
Still it does not work.
Considerations:
My visualizations were working well before I installed R 4.0.2
My visualizations are working well on other PCs
When I run the code on RStudio I don't get any error
Any thoughts?
You probably need to go here: https://powerbi.microsoft.com/en-us/support/, but some guesses:
When you did the reinstall, you didn't clean up the old one, so you now have a mix of old and new versions of things. If you can run R code, run
system.file(package="ggplot2")
That's where it is finding the bad version of ggplot2. Get rid of it, and reinstall. If that's not enough, run
.libPaths()
in the broken copy of R. Completely eradicate every directory mentioned there, and reinstall R and all of your contributed packages. (I don't use Power BI, so this might also require you to wipe out some part of it: do so, and reinstall it.)
After all of this, run
packageDescription("ggplot2")
In the last line (or close to it) of what gets printed, you should see something like this:
Built: R 4.0.2; ; 2020-07-16 22:49:23 UTC; unix
If you see that it was built before 4.0.2, then either you missed deleting something, or you (or Microsoft) reinstalled some old version. Then it's probably time to contact that URL above.

Tidyverse not installing

I'm having a bit of a pickle right now with the package tidyverse, that I need for an assignment on layering maps. I tried installing the package using install.packages("tidyverse") and install.packages ("tidyverse", dependencies = TRUE) but when I ran library(tidyverse) it wasn't installed. I searched online and found that I had an older version of RStudio IDE so I uploaded the latest version (1.3.1056).
After installing the newest version, I reinstalled the package but R tells me the following:
"Rtools is required to build R packages but is not currently
installed".
So, I did it, but the R tells me Rtools package is not available for R version 3.5.3.
What can I do to use tidyverse?
It could be a permissions issue, try setting the directory for where you install R packages/libraries on your computer using libpaths. I have to do this on my work laptop because the university has it set up to store things like this in a tempporary directory on the remote server which isn't desirable.
.libPaths("C:/R")
.libPaths()

R-Studio on OSX can't load mosaic package

I am running OSX 10.10, R-Studio Version 0.99.484, and R version 3.2.2.
I just made a fresh install of R and R-Studio using the installers from their respective websites. I use install.packages to install "mosaic" and then I try loading it using library, but it gives me the following error:
library("mosaic", lib.loc="/Library/Frameworks/R.framework/Versions/3.2/Resources/library")
Error : object ‘dendro_data.hclust’ is not exported by 'namespace:ggdendro'
Error: package or namespace load failed for ‘mosaic’
I tried reinstalling ggdendro but nothing. Does anyone have any advice on how to deal with this issue?
I encountered this same error and seem to have somewhere along the way resolved it. Steps taken include:
cleaned out my libraries (local and System)
used Disk Utility to repair any odd permissions
reinstalled R
opened RStudio and imported package with dependencies from the repository:
> install.packages("mosaic", lib="/Library/Frameworks/R.framework/Versions/3.2/Resources/library")
console prompted me to choose the older precompiled package or the newer, I chose older
Do you want to install from sources the package which needs compilation?
y/n: n
mosaic loaded happily
> library("mosaic", lib.loc="/Library/Frameworks/R.framework/Versions/3.2/Resources/library")

Error while running a shiny app on ubuntu

I have made a shiny app which works fine on windows, but when I tried running the same on my ubuntu system the app exists abruptly and I get following error
Loading required package: TTR
Version 0.4-0 included new data defaults. See ?getSymbols.
Error in library(rstudio) : there is no package called ‘rstudio’
After this I tried installing the 'rstudio' package and I am getting the following message:
Warning in install.packages :
package ‘rstudio’ is not available (for R version 3.2.1)
My R version is: 3.2.1 and my RStudio version is: 0.99.467
Note: I am new to ubuntu and the only reason I shifted to ubuntu, was to to use shiny-server.
The rstudio package comes with the installation of RStudio (Desktop or Server). If you need to use the rstudio package, you probably need to install RStudio (Dekstop or Server version).
You can do that from here:
https://www.rstudio.com/products/rstudio/download-server/
That said, I'm not clear on why you would need to load the rstudio package.
That is because there is no package called rstudio (at least not on CRAN anyways). Either there is a typo and you really meant the rstudioapi package, or on your windows system you actually did install a package named rstudio that, however, was distributed from another source other than CRAN. I'd suggest try removing the line library(rstudio) and see if it works.

Resources