I just installed R on my new computer and want to install some packages. But im running into some strange errors when doing this.
When I do this:
install.packages(iris)
I get the following error:
Installing package into ‘C:/Users/Marc/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning message:
ackage ‘iris’ is not available (for R version 3.2.2)
I especially dont get the unspecified lib part as I just set it (.libPaths("C:/Users/Marc/Desktop/R/Library"))
Any thoughts on what is causing this error?
Because there is no iris package (as #etienne said). If you do ?iris (or google for it) it tells you that iris dataset comes with datasets package.
I thought datasets package came bundled with R.
(If it doesn't, or if yours got corrupted somehow, install.packages('datasets', ...)
Related
I have been using bizdays package for a long time and since I changed my window installation recently I had to install all of the packages for R. The only package that is not installed is bizdays. The documentations appear to show this package should be still on CRAN, but I cannot find it or install it. Is there any way to somehow install it back?
This is the error I am getting:
install.packages("bizdays")
Installing package into ‘C:/Users/me/OneDrive/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified)
So it seems the package got installed, and when I try to use it this is the error thrown:
library(bizdays)
Error in library(bizdays) : there is no package called ‘bizdays’
You may need to update R to =>4.0
You can check with R.version.
Needing to update R is a fairly common cause of package install problems, as packages can use new R features. You will need to restart RStudio
I'm new at R and trying to usetidyverse. The installation seems to go fine, but when I want to load the package, I get this error: there is no package called 'tzdb'. When I try to install 'tzdb' I get a warning that package 'tzdb' is not available for this version of R. I'm using version 4.0.5, which I believe should work.
Any suggestions on how I can get this package to work (so I can start using tidyverse)?
Edit: I've added an image of the code I ran + the outputs of sessionInfo() , options("repos") and .libPaths() below. (I'm sorry I can't copy paste code nor use the browser of the virtual machine that I work from).
https://i.stack.imgur.com/hra1r.png
It does give a warning stating that the CRAN mirror is set to an insecure URL. Could that be the problem? It didnt't seem matter for the other packages.
This is a problem that comes up repeatedly, e.g.
Error in install.packages : cannot remove prior installation of package ‘DBI’
Warning in install.packages : cannot remove prior installation of package ‘data.table’
Unable to install package forecast in R
Install error of package plyr
Unable to install package zoo
I have come across this issue multiple times. Most annoying is when it occurs with a bunch of packages; e.g. I do something like
update.packages(ask = FALSE)
and get a number of these errors. The error is misleading though, because R tends to actually remove the old package version---but then doesn't install the new version. Once this happens, you can't fix it with update.packages; you have to reinstall it from scratch.
The most frustrating aspect of this problem is that it often occurs when installing dependencies, so e.g. I might successfully update dplyr, but in the process Rcpp is removed. Now I can't load dplyr because Rcpp is missing, so I need to reinstall Rcpp.
My current workaround (when the number of uninstalled packages is large) is to close all of my R sessions, open a new one with the base R GUI (i.e. not RStudio or RTVS) and do
lapply(dir(.libPaths()), install.packages)
which reinstalls my entire library. This is overkill.
Is there a better way to check which folders in .libPaths() actually contain packages, so that I only reinstall the missing packages?
Alternatively: Is there a better way to check for missing package depedencies?
One strategy is to do
setdiff(dir(.libPaths()), .packages(all = TRUE))
To get a list of directories in the library that don't seem to actually contain packages. Now I have a much smaller list of packages to reinstall.
I'm not sure if it's foolproof, but it's better than reinstalling my entire library.
I am using R version 3.0.3.
I would like to install the package "imputation". I would like to re-run an analysis I used last year in R version 3.0.2.
I also have a new computer so I am re-installing my packages. I would like to install the package "imputation".
install.packages("imputation")
However, I received the following error:
Installing package into ‘\\oxdc/userdata/jolyon.faria/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘imputation’ is not available (for R version 3.0.3)
How can I work around this problem? I thought I could perhaps run two versions of R on the same computer but this may throw up its own problems.
Always check CRAN for package problems:
http://cran.r-project.org/web/packages/imputation/
You might be able to get it working on 3.0.3 or later by installing from source via the source archive.
Or contact the maintainer and ask them if they can fix the problem that caused the removal from CRAN.
I am trying to install "rpart" package in R. But I am getting the following error.
> install.packages('rpart')
Warning in install.packages("rpart") :
argument 'lib' is missing: using '/home/sandeep/R/i686-pc-linux-gnu-library/2.11'
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘rpart’ is not available
Can anyone please tell whats the error about? How to solve?
A tip to start: If you're not sure whether you have a package already, you can use eg the function find.package() to check:
> find.package('rpart')
[1] "D:/R/library/rpart"
> find.package('lololool')
Error in find.package("lololool") : there is no package called 'lololool'
The problem is not so much that it is installed by default. It can be downloaded and installed from CRAN without problem using install.packages('rpart'), but if you check at the package page on CRAN, you see a very important line:
Depends: R (≥ 2.13.0), graphics, stats, grDevices
which tells you that it is only available for R 2.13 and following versions. From your error, I deduce you still run 2.11. Quite some packages are not available for that old R version from CRAN any more, so you better update your R. Otherwise you'll run into this problem more often.
Be aware that if you run Debian, you'll have to do a bit more effort, as the default R in debian is always outdated. Just in case, you find the directions to do that here.
I found that once I restarted RStudio that I was able to install the package and find.package() showed I did, now, have the packages.