Failure in installing packages - r

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.

Related

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.

How to solve the package installing problem in RStudio?

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?

Trouble Installing and Calling R Package

I am trying to install the R package "rattle".
I do so by simply typing:
install.packages("rattle")
...upon which a lot of good installin' seems to take place. But then when I call the package
library(rattle)
I get the error message
Error: package or namespace load failed for ‘rattle’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘stringi’
All of the research I've done online suggests some form of
install.packages("rattle", insert_something_here)
but I've had no luck with such methods.
Any ideas on what I'm missing?
Ok, so the entire issue seemed to revolve around the stringi package.
I first installed the latest Rtools package from
https://cran.r-project.org/bin/windows/Rtools/
and then I was able to successfully install stringi manually
install.packages("stringi")
and then I could call rattle no problem.

Installing tm package in R

I am facing problem while installing tm package in r version 3.2.3. I have tried implementing different ways available in internet and the stack overflow answers. I don't know where I am going wrong.
It shows
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace ‘slam’ 0.1-32 is being loaded, but >= 0.1.37 is required
ERROR: lazy loading failed for package ‘tm’
* removing ‘/home/alankrita/R/x86_64-pc-linux-gnu-library/3.2/tm’
Warning in install.packages :
installation of package ‘tm’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPSKOOW/downloaded_packages’"
Any help will be appreciated. :)
I solved this problem by upgrading my version of R to the latest version, and then trying the install tm package again. If you're on Linux you can do this quite easily by adding the Cran site to your repository list, and then updating your version of r-base.
For Ubuntu users a good description of adding the Cran repo can be found here. Once you've pointed your system to the Cran repo the upgrade of the r version can be achieved with:
sudo apt-get install r-base

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

Resources