can't load package kknn in r studio - r

looks like the package has been successfully installed, however, the below message keeps appearing:
Error: package or namespace load failed for ‘kknn’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘lattice’
The kknn package was successfully installed before today. But I can't knit the document to pdf, so I installed a package called latexpdf. After that, the whole RStudio just doesn't function well. I don't know what happened... tried to re-install but doesn't help.
Does anyone know what should I do with this? thank you!

Thanks for the modification!
I installed Lattice package and the problem solved...what a silly question...

Related

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!

installing 2 ggplot in R and getting an error

i am trying to install ggplot 2 into R . The instalation works well but when i write:
library("ggplot2")
i get an error:
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc,
.libPaths()), versionCheck = vI[[i]]):
there is no package called ‘lifecycle’
i looked online to find any help, restarted R nothing worked.
i insataled the lifrcycle package didnt help at all.
instald ggplot2 from the tool bar how can i fix this ?
thank you :)

Error: package or namespace load failed for ‘tmap’

I am getting the error below when I am trying to run my shiny app which used to work properly; I did not get this error using the old version of my R/Rstudio. Currently, I am using Version 1.1.463 of Rstudio, and R version 4.0.3.
Thanks,
Nader
Error: package or namespace load failed for ‘tmap’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘raster’
The problem was with installing the ratser. When the question below prompted during the installation, I answered no instead of yes, and this solved the issue. Thanks.
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)

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.

Error using library(caret) in RStudio

I have been trying to use caret library for a simple ML application. I am using the latest versions of R (3.4.3) and RStudio (1.1.414). Here is my approach
install.packages("caret",repos = "http://cran.r-project.org", dependencies = c("Depends", "Imports", "Suggests"))
when I run the code library(caret) I get the following error
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gower’
Now I went forward and installed the packages that it suggests one by one i.e., DEoptimR, gower, etc. This list never ends as once I install a package it will ask for another package. I am so frustrated. I have literally looked up in every forum but it did not solve my problem. I am not sure why the code install.package does not install all the required packages even though I ask explicitly to do so. when I check .libPaths() I can see it has access to both my library directories
[1] "C:/Users/omid/Documents/R/win-library/3.4"
[2] "C:/Program Files/R/R-3.4.3/library"
would anyone be able to help please?
Edit 1:
install.packages("caret",repos = "https://cran.r-project.org", dependencies = c("Depends", "Imports"))
Installing package into ‘C:/Users/omidm/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/bin/windows/contrib/3.4/caret_6.0-78.zip'
Content type 'application/zip' length 5155777 bytes (4.9 MB)
downloaded 4.9 MB
package ‘caret’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\omidm\AppData\Local\Temp\RtmpGuZ1vH\downloaded_packages
library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gower’
I also uninstalled R and RStudio and installed them again. Still getting the same error.
Solved:
I managed to solve this issue somehow, however, I am still not sure how. here is what I did
Open R GUI (not RStudio) and run:
install.packages("installr") # install
installr::updateR() # updating R
type q() to exit and then open RStudio. Go to Packages and Update all packages
Install package caret as per comments from #chinsoon and #Ronald
install.packages("caret", dependencies=c("Depends", "Imports"))
if you still get an error about any package just install that one. It will not ask for any other packages as you have removed "Suggest" from dependencies. Hope this manages to solve some people's problem.
Easy and simply:
install.packages("gower")
library(caret)
omg! yes ive been trying to find a solution for days! basically install anything it asks. I had to do the following
install.packages("gower")
library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘hardhat’
install.packages("hardhat")
library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘parallelly’
install.packages("parallelly")
then ran library(caret) and it worked

Resources