How to solve the package installing problem in RStudio? - r

I have been trying to install ggfortify package in my RStudio.
So, I have used the following codes as this is not a built-in package-
if(!require(devtools)) install.packages("devtools")
devtools::install_github("sinhrks/ggfortify")
install.packages ("ggfortify")
library(ggfortify)
Since then I could not be able to install any packages in my RStudio. What should I do now.
The followings are the error messages I got while installing the ggplot2 package:
require("ggplot2")
error messages -
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(j <- i[[1L]],
c(lib.loc,.libPaths()), versionCheck = vI[[j]]):
namespace ‘pillar’ 1.4.2 is being loaded, but >= 1.4.3 is required
How can I fix this? should I uninstall and reinstall R studio?

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.

impossible to find the function "ggplot"

I am having problems with ggplot, getting the above error message.See full error message below after running library(ggplot2):
Error: package or namespace load failed for 'ggplot2' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
'vctrs' package 0.3.6 is already loaded, but >= 0.3.8 is required
Also: Warning message:
package 'ggplot2' was compiled with R 4.0.5
I have tried removing the package and then reinstalling it with dependencies. Nothing seems to work. The error seems to have been triggered when I tried to do an install of the ggflags package from Github, the package info states that it is a ggplot extension. Please give me an idea of how to fix this because I use ggplot for all data viz in R
Try the following shotgun-approach, as I suspect you are missing relevant packages,
# remove packages
remove.packages("tidyverse")
# reinstall
install.packages("tidyverse", dependencies = TRUE)
If this does not work, you should post your sessionInfo() in your post.

rstatix package installation

I´m having problems with the "rstatix" package installation. When the installation finishes and I try to run the library, I get this message:
Error: package or namespace load failed for ‘rstatix’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘vctrs’ 0.2.0 is being loaded, but >= 0.3.2 is required
In addition: Warning message:
package ‘rstatix’ was built under R version 3.6.3
Have any of you dealt with this problem before? How did you solve it? Thanks!
I think the "vctrs" package should be >= 0.3.2. Try to update the "vctrs" package to the latest one.
# below is the command to update the package
install.packages("vctrs")
# if you want to update all packages
update.packages()
After this try to import your package.

Issue installing Hmisc in Rstudio and calling in the library

I've had the following error for the package Hmisc. I read another thread which asked more about the error message however it said not to post this as a comment. I've installed the package and received the following error when calling in the library:
> library(Hmisc)
Error: package or namespace load failed for ‘Hmisc’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘checkmate’
In addition: Warning message:
package ‘Hmisc’ was built under R version 3.4.4
I've tried deleting the install and then installing checkmate separately and manually installing this from a browser rather than through R directly. However the same error message is returning. Does anyone know how to overcome this? Or similar packages to Hmisc. I need to package for a wtd.quantile function.
install.packages('lattice')
library('lattice')
install.packages('survival')
library('survival')
install.packages('Formula')
library('Formula')
install.packages('ggplot2')
library('ggplot2')
install.packages('checkmate')
library('checkmate')
install.packages('htmlwidgets')
library('htmlwidgets')
install.packages('stringi')
library('stringi')
install.packages('Hmisc')
library('Hmisc')

Error while loading ggplot2 package

I get the following error when I try to load ggplot2. I tried to uninstall scales and reinstall it but for some reason R can't find the package when I want to remove the package...
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘scales’ 0.2.5 is already loaded, but >= 0.3.0 is required
In addition: Warning message:
package ‘ggplot2’ was built under R version 3.2.3
Error: package or namespace load failed for ‘ggplot2’
I had the same problem, I just install again ggplot2 and everything worked again. It installed also scales 0.4.2, so it solved the problem by itself.

Resources