How to solve the problem while loading package "ggtext" in R? - r

I want to use ggtext packgae for visualization in R, but while I loaded the packgae that I have installed before I found this error:
Error: package or namespace load failed for ‘ggtext’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘ggplot2’ 3.1.0 is already loaded, but >= 3.3.0 is required
What might be the main problem? How can I solve it?

That error helps... when it says: "namespace ‘ggplot2’ 3.1.0 is already loaded, but >= 3.3.0 is required" means that the version of ggtext you've installed needs ggplot2 to be upgraded (to at least 3.3.0) for it to work (it must use a newish feature in ggplot).
Fix: restart R, install.packages("ggplot2"), then try again (you may need to install.packages("ggtext") again).

Related

Failure in installing packages

I have written my code a-2 months ago and i try to reuse it, but the installation of packages fails and i become this warning:
install.packages("devtools")
library("devtools")
> library("devtools")
Loading required package: usethis
Error: package or namespace load failed for ‘usethis’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘cli’ 3.3.0 is already loaded, but >= 3.4.0 is required
Error: package ‘usethis’ could not be loaded
Although i reinstalled RStudio and R, tried to upadte all packages and install all their dependencies etc, it fails to install the updates/packages. Do you have any idea? Thank you in advance.
first you need to check from bottom right (Packages) and search for devtools if you found check if installed or not, also you can write ?devtools to see if help page show up for Package development tools for R, if you want to use the package you can write devtools:: and follow it with the name of function.

A problem with the `cli` package the is affecting `ggfortify` and `tidyr` packages? [duplicate]

strong textI keep encountering problems with installing tidyverse package, which preventing me from implementing many text processing tasks. The problem is the same as those mentioned in many previous threads since 2017 in that when I enter library(tidyverse) or try to open other related packages, they always say it requires 0.2.1 version of vctrs. I have tried using remote download or download other temporary versions but to avail. Could someone help me on this?
I'm using the latest version of R (version 3.6.1), running on Rstudio 1.2.5033. I also updated my vctrs package.
install.packages("tidyverse")
devtools::install_github("tidyverse/tidyverse")
library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘vctrs’ 0.2.0 is already loaded, but >= 0.2.1 is required
In addition: Warning message:
package ‘tidyverse’ was built under R version 3.6.2
library(devtools)
devtools::install_github("tidyverse/tidyverse")
library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘vctrs’ 0.2.0 is already loaded, but >= 0.2.1 is required
In addition: Warning message:
package ‘tidyverse’ was built under R version 3.6.2
This has already been answered above, and I am leaving my notes for other "beginners" that may have run into the same thing. I encountered this issue after installing tidymodels (have since removed).
Had issue with rlang first: namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.10 is required
remove.packages("rlang"), install.packages("rlang")
Then had issue with vctrs: namespace ‘vctrs’ 0.3.2 is already loaded, but >= 0.3.6 is required
does not respond to the remove/install process.
Shut down R, manually delete the vctrs directory from lib, per Edward's message above. Will be somewhere like: C:\Users\Chris\Documents\R\win-library\3.6\vctrs
Start RStudio. install.packages("vctrs")
After this, I could load tidyverse again.
It´s important to check for packages updates. It´s in tool menu->check for package updates->choose the packages. I had the same problem with other package "drc" and it gave me the same error with old version of "vctr".
You've probably got more than one instance of R running with those tidyverse packages loaded. Not sure about other operating systems, but on Windows, if these packages are being used, then those DLL files will be in use and you cannot delete them, which is what the install.packages() function will try to do.
So, just close all but one instance of R, maybe restart the computer just to be sure, and try again.
I had the same issue:
namespace 'vctrs' 0.3.7 is already loaded, but >= 0.3.8 is required
I tried:
unloadNamespace("vctrs")
namespace 'vctrs' is imported by 'pillar' so cannot be unloaded
So then:
install.packages("pillar")
It automatically restarts R and re-installs pillar. This worked for me!
I had the same problem and I installed Rtools, which is a package management tool for R, from https://cran.r-project.org/bin/windows/Rtools/ and it worked!

How to fix the issue with loading "Tidyverse" and "dplyr"

I am having trouble to load library "dplyr" and "tidyverse". I used to load them very often since today that I am getting the following error
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
namespace ‘rlang’ 0.4.5 is already loaded, but >= 0.4.6 is required
I tried to update my RStudio and update all packages rom tools option in RStudio. I also reinstall "rlang" package. But I am still unable to load dplyr and tidyverse. I am using R version 3.5.2 and RStudio Version 1.3.1073
I followed some threads online but none worked. Do you have any idea how I can fix the issue?

Error message when installing ggplot2

I have been trying to install ggplot2 but get the following error:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘scales’ 0.4.0 is being loaded, but >= 0.4.1 is required
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/ggplot2’
Just so you know, I am using RStudio 1.0.136 and R 3.2.1 GUI Snow Leopard. Could it be a problem of compatibility with the old version of R that I am using? Does anyone know what the above means?
install.packages("scales")
install.packages("ggplot2")
will do the trick. Also try to keep your packages in R updated in the future, since R packages usually depend on the latest versions of other packages.
if you are on windows try :
install.packages("ggplot2", type="win.binary",dependencies = TRUE) else check the documentation in type and binary packages sections for the correct type according to your os :
https://www.rdocumentation.org/packages/utils/versions/3.5.2/topics/install.packages

ggplot2 version 0.9.3.1 won't load into R 3.0.2

I accidentally deleted my old version of ggplot2, so I downloaded the new version, and when I use
library(ggplot2)
I get the following error:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘colorspace’
Error: package or namespace load failed for ‘ggplot2’
Does anyone know how to fix this? I tried reinstalling the older version of ggplot2 in both R 3.0.2 and R 3.0.1 (where it previously worked!) and it says the package is not available.
If anyone has a solution to how to fix the loading of the new version or how to get the old version work again, I would be indebted - I really need to plot something with ggplot!!
Cheers
Install the missing colorspace package by executing the following line in R:
install.packages("colorspace")
I fixed it by installing Tk and Tktable in my linux machine.

Resources