Tidy Verse Issue - r

I am using tidyverse for the first time and I am very new to R and Rstudio.
I installed the tidyverse package in Rstudio and continued with my code.
My code until now is just this:
library (tidyverse)
damsel <- read.csv("mecistogaster_in_bromeliads_multiyear.csv")
damsel %>% filter (genus == "Weruhaia")
When I piped, it gave me the error saying that object 'genus' is not found.
When I looked into my packages tidyverse was not ticked-- So I tried to again reload it by typing library (tidyverse).
It showed me the following error 'Error: package or namespace load failed for ‘dplyr’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘pillar’'
I have tried to restart R three times since this issue and all the three times I get the same error.
How do I get this to work?

Did you run
Install.packages(“tidyverse”)
cderv wrote on community.studio.com:
install.packages("tidyverse", dependencies = TRUE) to install everything tidyverse depends on.
Once installed.
library(tidyverse)
This may be the blind leading the blind, but... Have you successfully installed any packages? If not, there could be an issue of where your packages are installing.

Related

Error: Failing to install Tidyverse package

Below is the exact error code. I am new to R, RStudio, and tidyverse. I did load Tidyverse two years ago for a class on the same computer but have not used it since. Below is the exact error code.
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘purrr’ 0.3.4 is already loaded, but >= 1.0.1 is required
I have turned both the R program and R studio off and on again, and turned my computer off and on again. The same error occurs. I may uninstall and reinstall R to see if that helps.
As it turns out, the purrr package was out of date, which it actually says in the last line of code. I just needed time to stop and think.

How to load sjPlot when receiving namespace:insight error?

When loading sjPlot, I receive the following error:
Error: package or namespace load failed for ‘sjPlot’:
object ‘reshape_ci’ is not exported by 'namespace:insight'
I read elsewhere that the insight package might be out of date. So I've tried to update the insight package to no avail. I also tried updating the sjPlot package without success. I did all of these things in combination with restarting a clean RStudio session (closing and re-opening RStudio) and also removed and re-installed sjPlot and insight. I also tried update.packages() for both sjPlot and insight.
I'm out of ideas on how to load the sjPlot package at this point. How can I load it?
I had the same problem:
library("sjPlot")
Error: package or namespace load failed for ‘sjPlot’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘nloptr’
After many tries I receive a message from R:
Install package "strengejacke" from GitHub (devtools::install_github("strengejacke/strengejacke")) to load all sj-packages at once!

R tells me I'm missing a dependency package when I'm not?

I have a handful of R scripts that I routinely run every day so all of the necessary packages have been running just fine for months. Yesterday I installed the RInno package and I believe this has somehow affected other packages because my routine scripts no longer run due to the inability to load my normal packages.
When troubleshooting I started with the odbc package. When trying to load it gives me:
Error: package or namespace load failed for ‘odbc’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘Rcpp’
I then ran .libPaths(), checked both of the returned paths, and the Rcpp package existed in both.
I've even tried re-installing both odbc and Rcpp with no luck. Does anyone know what could be going on here?
Update1: While trying to re-install Rcpp did not work, re-installing dplyr did manage to fix the missing rlang issue. So I decided to go download Rcpp directly from https://cran.r-project.org/web/packages/Rcpp/index.html and then paste it manually into both of my library folders. This seems to have fixed the Rcpp issue but I am now met with the following new error when trying to load odbc or run devtools::session_info():
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : object 'vI' not found
Update2: Ultimately I decided to do a restore on my two library folders to a time before I installed RInno and it seems to have worked. I still have no idea what RInno did but I won't be trying that again.

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.

updating package in R: `update.packages` vs. `install.packages`

I've tried to load the party library and got the following error:
Loading required package: zoo
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘lattice’ 0.20-24 is already loaded, but >= 0.20.27 is required
Error: package ‘zoo’ could not be loaded
So I decided to update all packages within the same session (detach all packages while working in R), including lattice, hoping that zoo and then party would then load correctly once lattice is updated:
pkgs <- names( sessionInfo()$otherPkgs )
pkgs <- paste('package:', pkgs, sep = "")
lapply( pkgs , detach, character.only = TRUE, unload = TRUE)
update.packages(checkBuilt=TRUE, ask=FALSE,
repos="http://r-forge.r-project.org",
oldPkgs=c("lattice","zoo","party")
)
It didn't work (within the same session and after re-starting without preloading .RData):
> library(party)
Loading required package: zoo
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘lattice’ 0.20-24 is already loaded, but >= 0.20.27 is required
Error: package ‘zoo’ could not be loaded
According to How to update R2jags in R? it's best to simply run install.packages on those packages I want to update, then restart. And indeed it did the trick.
So here's the question: when is update.packages called for, given that updating within a running session is fragile to say the least, and install.package will do the trick at the cost of restarting the session? What bit of R package management voodoo am I missing? Thanks.
Dirk offers a more general strategy to avoid this issue. However, if you are in an interactive session that you don't feel like rebooting, and you want to unload a package that needs updating (which neither detach(.)-ing orupdate.packages(.)-ing effectively accomplishes), then there is a function, unloadNamespace that usually works for me. There are warnings in its help page that say it's not entirely safe, but I have not had difficulties. Try:
unloadNamespace("lattice") # or lapply()-ing as you attempted with `detach`
update.packages("lattice")
require(lattice) # or library()
This is yet another reason why I prefer to launch both the "install" and "update" operations outside of my current, working R session.
By using the command-line, I get fresh R sessions without loaded packages, and the issue you experienced here does not arise. And as a shortcut, I define scripts update.r and install.r using littler (and included in the examples/ directory of that package) but you can of course do the same via Rscript.

Resources