rpart package installation in R - r

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.

Related

Can't install package 'nutshell' from O'Reilly book 'R in a Nutshell' onto Mac

My first post in an early programming career - any help very welcome.
I am studying R, and using a book called R in Nutshell (O'Reilly). The book is supported by a package that was previously available on CRAN. The package on CRAN has been archived - it is still there though as nutshell_2.0.tar.gz.
I am running MacOS Catalina, R version 3.2.1.(after downgrading from 4.02 to try and solve this issue , without success), and RStudio version 1.3.1093.
When I try to install the package into R via RStudio I have this experience:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/nutshell/nutshell_2.0.tar.gz
install.packages(packageurl,contriburl=NULL,type="source")
Warning in install.packages :
package ‘https://cran.r-project.org/src/contrib/Archive/nutshell/nutshell_2.0.tar.gz’ is not available (for R version 3.2.1)
I have a similar experience if I download the tar.gz file and try to import it directly under Tools/Install Packages.
I am able to install other packages on CRAN successfully.
Many thanks
Up front, I'm doing this on windows and not on macos, but the packages here have no compiled code so there should be few if any differences. Also, I tested on R-4.0.2; I don't think this will be a problem, because these packages appear to have been last-updated in 2012, so if they install on my 4.0.2, then they are likely to work on every version of R since then (including your 4+ year-old R-3.2).
download.file("https://cran.r-project.org/src/contrib/Archive/nutshell.audioscrobbler/nutshell.audioscrobbler_1.0.tar.gz", "nutshell.audioscrobbler_1.0.tar.gz")
download.file("https://cran.r-project.org/src/contrib/Archive/nutshell.bbdb/nutshell.bbdb_1.0.tar.gz", "nutshell.bbdb_1.0.tar.gz")
download.file("https://cran.r-project.org/src/contrib/Archive/nutshell/nutshell_2.0.tar.gz", "nutshell_2.0.tar.gz")
install.packages("nutshell.audioscrobbler_1.0.tar.gz", repos = NULL)
install.packages("nutshell.bbdb_1.0.tar.gz", repos = NULL)
install.packages("nutshell_2.0.tar.gz", repos = NULL)
I tried reproducing installation from archive. I got error that dependencies of this package are not available.
ERROR: dependencies 'nutshell.bbdb', 'nutshell.audioscrobbler' are not available for package 'nutshell'
* removing 'C:/Program Files/R/R-3.6.2/library/nutshell'
Warning in install.packages :
installation of package ‘D:/Profile/maszpa1/Desktop/nutshell_2.0.tar.gz’ had non-zero exit status
Did you get the same error? If yes, then did you try to install them and try again?
As per the accepted answer, the solution was to install the missing dependent packages first, then the Nutshell package.
I was then able to update to R4.02
audioscrobbler_1.0.tar.gz
nutshell.bbdb_1.0.tar.gz
nutshell_2.0.tar.gz

R 3.5 package ‘lattice’ was installed by an R version with different internals

I updated R 3.4.4 to R 3.5.0 today. And my package cannot pass R CMD check anymore. It fails at checking whether package can be installed ... ERROR.
In another hand my package works, I can install it and use it as long as I don't check it.
The error is the following:
Error: package or namespace load failed for ‘sp’:
package ‘lattice’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
Error : package ‘sp’ could not be loaded
I tried to reinstall lattice these ways:
sudo apt-get --reinstall install r-cran-lattice
or
remove.packages("lattice", lib="~/R/x86_64-pc-linux-gnu-library/3.5")
install.package("lattice")
The package lattice is installed correctly in both cases. But it does not solve my problem. Also I ensured to have a single version of lattice removing either the r-cran one or the self compiled version. Nothing works.
Edit By the way I can do library(sp) or library(lattice) it works. But not with R CMD check
The error message tells you that the binary you are attempting to install comes from an insufficient / incompatible R version.
Two fixes:
Install from source as you did. After that check with AP <- available.packages() that you really only have one.
Use the correct binarie: read this README at CRAN and switch to Michael's 'R 3.5' repos. Many of us have been doing that for weeks.
Lastly, the r-sig-debian list is a friendly place for these questions and more. Subscribe first so that you can post.

Bioconductor DNACopy package xxx is not available (for R version 3.2.1)

I know there are a few similar questions out there, particularly this one:
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
The answer is bit overwhelming to me, frankly, since I'm not quite familiar with R settings/installation etc. I tried some solutions, but didn't get it work yet.
What I want to do is to install some bioconductor packages from here:
https://www.bioconductor.org/packages/release/BiocViews.html#___CopyNumberVariation
for example "CNVPanelizer", but I got the following error message:
> biocLite("CNVPanelizer")
BioC_mirror: http://bioconductor.org
Using Bioconductor version 2.14 (BiocInstaller 1.14.3), R version 3.2.1.
Installing package(s) 'CNVPanelizer'
Old packages: 'PSCBS', 'rgl'
Update all/some/none? [a/s/n]: #--- I tried 'a' and 'n', neither working
Warning message:
package ‘CNVPanelizer’ is not available (for R version 3.2.1) #--- this is the error message I got, as shown in my topic title
For all packages in bioconductor/dnacopy web page, I got the same error message.
Anyone has a simple solution? A step by step guidance will be highly appreciated!
TIA
Try to clarify here (as to answer comments below)
I tried both "a" and "n" options when asked "Update all/some/none? [a/s/n]:". Neither works.
> library("CNVPanelizer")
Error in library("CNVPanelizer") :
there is no package called ‘CNVPanelizer’
How to install an old version of Bioconductor? I'll google meanwhile...
Thanks.
Update:
I tried upgrade R, Bioconductor, biocinstaller. This works for some packages listed on this page:
https://www.bioconductor.org/packages/release/BiocViews.html#___CopyNumberVariation
such as exomeCopy. some installed with warnings; some with errors, such as CNVPanelizer. and one common error is
Old packages: 'rgl'
I saw this 'rgl' before I upgrade R/Bioconductor. And sometime I see messages saying removing 'rgl' and 'rgl' reinstalled. Don't know what this 'rgl' thing is......
You are running Bioconductor 3.1 but according to the landing page for CNVPanelizer, it was introduced in Bioconductor 3.2. So you should upgrade:
library(BiocInstaller)
biocLite("BiocUpgrade")
Then you should be able to install CNVPanelizer:
biocLite("CNVPanelizer")
And actually after upgrading you should upgrade all your existing packages by calling biocLite() without arguments.

R Install Packages Undable to Access Repository

I'm new to R, and I'm trying to install the "Reshape" package, but I get this error
install.packages("reshape")
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib
Warning: unable to access index for repository https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2
Warning message:
package ‘reshape’ is not available (for R version 3.2.1)
I've searched around, seems this should definitely be available for download, but I can't figure out whats causing the issue
I had the same problem... I went to the Default CRAN Mirror to an HTTP mirro and that seems to have resolved it.
I hope this helps you too.
Felipe
I got exactly the same error message. I got it with loading other packages too, but after I downloaded the latest versions of R and R Studio I was able to load them but seems there is not a 'reshape' version compatible with R 3.2.1 yet.

R 3.0.1 package build warning

I'm building R packages in R 3.0.1 on a Windows machine, using Rtools30 and the 'Build' tools associated with RStudio, which I assume is tied in with devtools (which is up-to-date). My typical process to build a package is:
Load All
Reoxygenize
Build & Reload
Check
Build Source Package
If everything goes without errors or warnings, I then:
install.packages("foo.tar.gz", repos=NULL, type="source")
Since upgrading to R 3.0.1, I now get this warning:
Warning in install.packages :
foo.tar.gz is not available (for R version 3.0.1)
I also tried before installing, and it did not get rid of the warning:
options(install.packages.check.source = FALSE)
Also, I notice this warning when I open the devtools library:
WARNING: Rtools 3.0 found on the path at c:/Rtools is not compatible with R 3.0.1.
Which is weird, Rtools 3.0 is suppose to be good from R >2.15.1 to R 3.0.x
Any ideas what is going on?
This is RStudio specific, as they wrap and/or changed a lot of functions from the utils for better integration. The problem lies with a call to getDependencies() to check for dependencies. But that function will also check whether the original package exists on CRAN and throws the given warning when it doesn't. A package you just built on your own computer is obviously not on CRAN, hence the warning.
In the source of the native install.packages(), getDependencies() isn't called in case you build from source or install from a different repository respectively. RStudio on the other hand calls getDependencies() before it passes everything on to the native install.packages() function.
This has to my knowledge no further effects, apart from confusing people. I didn't find a way to conveniently get rid of this in RStudio, as suppressWarnings() doesn't work in this context due to the complex way RStudio deals with this.
In a basic R console, you shouldn't have any problem.
So for the time being, I'd just ignore this and hope the RStudio team finds time to take care of this minor glitch.

Resources