I'm working on a school assignment and I loaded my data set and now I'm trying to run the following:
uncomment install.packages("caret") if already installed
install.packages("caret")
library(caret)
but I keep getting the following error message:
Error: package or namespace load failed for ‘caret’ 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
I have tried updating packages, uninstalling/reinstalling packages, I'm not sure what to do here. Can anyone please help?
Thanks for your response. I tried that previously and it didn't work. I just tried to install again, and got the same error message when I re-ran the code.
This is actually what comes up when I try to do install.packages(). But I have RTools installed already.
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
Hi @teitva,
You're using Windows, so you don't need to build (compile) the package from the source code - just install the latest pre-compiled binary from CRAN. Using this approach rtools is not needed.
Run install.packages("caret", dependencies=TRUE, type="win.binary"),
or use the RStudio pull-down menu in the "Packages" pane and answer "No" if you're asked about installing from source.
Whether on Win, Mac or Lin, if presented with the option to install from source, take it once. If it works fine. If it doesn’t, it will never compile for the vast majority of RStudio users who do not devote an appreciable portion of their time to development and are well versed in modifying source code to address situations peculiar to their choice of OS.
The “later source version” temptation can be avoided with a little patience. Binary versions usually do not lag past 10-14 days.
Among Linux distributions, building from source almost always succeeds unless there are missing dependencies on the target. Usually, a little rseeking will uncover the right name to bring in using apt install. Even here, though, the way can be smoother and the trip much shorter by using r2u from Dirk Eddelbuettel, the World’s Foremost Authority™️ on all things at the intersection of R and Debian.
Key features that allow installing all of tidyverse in under 20 seconds after downloading.
Full integration with apt as every binary resolves all its dependencies: No more installations (of pre-built archives) only to discover that a shared library is missing. No more surprises.
Full integration with apt so that an update of a system library cannot break an R package: if a (shared) library is used by a CRAN, the package manager knows and will not remove it. No more (R package) breakage from (system) library updates.
Installations are fast, automated and reversible thanks to package management layer.
Thank you thank you! I don't know what I kept doing wrong, but I ran the install.packages() you suggested, restarted RStudio, and IT WORKED! Phew! Thank you so much!