I'm not able to install the IntroCompFinR package in RStudio due to this error:
> install.packages("IntroCompFinR")
Installing package into ‘C:/Users/HP/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘IntroCompFinR’ is not available (for R version 3.6.1)
Try the R-Forge repo?
install.packages("IntroCompFinR", repos="http://R-Forge.R-project.org")
You may also have to install quadprog from another repo first.
install.packages("quadprog", repos="http://cran.rstudio.com")
install.packages("IntroCompFinR", repos="http://R-Forge.R-project.org")
install.packages("package_name") from devtools library works only when the package is enlisted in CRAN, and complies with your R version.
Three alternatives if it is available, but either not in CRAN or not compatible with your R version:
Install via Github: If your package is incorporated in a Github repository (most packages are), then you can use
install_github("github_UsernameOfAuthor/repository_name")
Other prominent repository holders include bitbucket and gitorious, for which
install_bitbucket("package_Author/repository_name")
and
install_gitorious("package_Author/repository_name")
apply respectively.
Install via R-Forge: If your repository is uploaded to R-Forge, you can use
install.packages("package_name", repos="http://R-Forge.R-project.org")
This is applicable in your case since there is an R-Forge repository for the IntroCompFinR library, with the install command being mentioned here as well.
Install via some other source URL/website: If your package has a repository somewhere on the internet, you can use the source-link to install the package via
install.packages("package_name", repos="URL")`.
Note: All of these commands are provided by devtools, which you seem to have, but just in case you don't, you can use these commands to install both devtools and your required package:
# Install directly from CRAN:
if(!require(devtools))install.packages("devtools")
devtools::install.packages("package_name")
# Install via Github:
if(!require(devtools))install.packages("devtools")
devtools::install_github("githubAuthor_username/package_name")
# Install via R-Forge or any other repository holding website:
if(!require(devtools))install.packages("devtools")
devtools::install.packages("package_name",repos="website-link")
Most package authors give installation commands in their package vignette or via their Github repository for the same, but you can acquire the package directly provided you know its name and link to the source repository.
You can use this post as a reference when installing R packages in the future.
Related
I've been having a lot of trouble installing the package "microbiomeSeq" in Rstudio.
I keep getting errors like:
ERROR: dependency 'KMDA' is not available for package 'microbiomeSeq'
removing 'C:/Users/14142/AppData/Local/R/win-library/4.2/microbiomeSeq'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmpc7iXOi/file7643cdd730b/microbiomeSeq_0.1.tar.gz’ had non-zero exit status
library(microbiomeSeq)
Error in library(microbiomeSeq) :
there is no package called ‘microbiomeSeq’
The KMDA package has been archived from CRAN:
Archived on 2022-06-14 as check problems were not corrected despite reminders.
Perhaps the maintainers will resolve this and republish (perhaps unlikely since the package has not been updated since 2015), but until then you can install it from github. Note: all (I think) CRAN packages are mirrored in their basic form under https://github.com/cran. I say "basic" because it is not a clone of the original github repo (if it is even on github), it is just a repo that is generated from the source tarball of packages released on CRAN.
if (!"remotes" %in% installed.packages()[,1]) install.packages("remotes")
remotes::install_github("cran/KMDA")
I am using the R programming language. I am trying to install the "Data Mining with R" (DMwR) package. However, when I visit the CRAN website for this package, it seems to be gone:
Package ‘DMwR’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2021-03-16 as check problems were not corrected despite reminders.
A summary of the most recent check results can be obtained from the check results archive.
I visited the Github page for this package
Then, I tried to install this package directly from Github:
> library(devtools)
Loading required package: usethis
Warning message:
package ‘usethis’ was built under R version 4.0.5
> install_github("Luis Torgo/DMwR")
Error: Failed to install 'unknown package' from GitHub:
JSON: EXPECTED value GOT <
But this also is not working. Can someone please show me how to install this package?
Besides installing from the CRAN mirror repo, another option is
remotes::install_version("DMwR", version="0.4.1")
for this method, you do have to look up the last version in the archive directory (would probably be scrapeable if you wanted to write the code)
as with remotes::install_github("cran/<package>"), you will be installing from source, which means that if the package or any of its dependencies have compiled components (in this case it doesn't appear so), you'll need to have development tools (compiler etc.) installed on your system
A quick word of caution:
this will work well if packages have been archived recently, and if the reason for archiving was because the CRAN maintainers are being fussy (that's their prerogative);
however, a package may have become incompatible with the rest of the current R ecosystem (R version, dependencies) since its last update - in which case you may find yourself in dependency hell trying to install it (or, worse, your results may be unreliable).
Had the same message on R 4.1.0
install.packages("DMwR")
Warning message:
package ‘DMwR’ is not available for this version of R
An option is also to create a checkpoint. According to the CRAN package website, it is archived on '2021-03-16'. So, we could use the checkpoint one day before that date
library(checkpoint)
checkpoint("2021-03-15")
install.packages("DMwR")
library(DMwR)
#Loading required package: lattice
#Loading required package: grid
#Registered S3 method overwritten by 'quantmod':
# method from
# as.zoo.data.frame zoo
The checkpoint can be deleted as well
delete_all_checkpoints()
You can install it from the CRAN github mirror (despite it being removed from CRAN), e.g.
library(devtools)
install_github("cran/DMwR")
That package was in support of a book published in 2010. The author published a second edition in 2017 and the current version of the support package is https://cran.r-project.org/web/packages/DMwR2/index.html
It does have currently CRAN-hosted source and binary packages, and doesn't need compilation, so it should be able to be installed with:
install.packages("DMwR2", dependencies=TRUE)
You can get the most recent version by following the directions at the Github site:
library(devtools) # You need to install this package!
install_github("ltorgo/DMwR2",ref="develop")
Those are much more likely to run properly with recent versions of R.
I'm trying to use plot.ci function in the zelig library but apparently Zelig is not supported with R 4.0.2. I'm trying to see if there is a work around to access these functions or if I just can't use this library until they make the appropriate updates. Please help.
Ethan
Error message below:
> install.packages('zeligverse')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/ethan/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘zeligverse’ is not available (for R version 4.0.2)
It looks like this package has been removed from CRAN's repository, meaning you can't install it like this anymore - you have to install it manually. This is explained on their website, and has download links for manual installation that have been archived:
https://cran.r-project.org/web/packages/zeligverse/index.html
You will also have to install the following dependencies (packages it requires) to install it correctly:
'Amelia', 'MatchIt', 'WhatIf', 'Zelig', 'ZeligChoice', 'ZeligEI'
The Zelig package that is currently available appears to support the function you mentioned. You can install it with:
install.packages("Zelig")
I would like to install a package when using the latest R version in RStudio.
In particular the quantstrat package
Is that possible?
This is the R latest version I have 3.4.1
my error message:
Warning in install.packages :
package ‘quantstrat’ is not available (for R version 3.4.1)
Because quantstrat build-fail at R-Forge, you can't get the pre-build file(.tar.gz). You can get the code from github and build by yourself.
install.packages("devtools")
require(devtools)
install_github("braverock/blotter") # dependency
install_github("braverock/quantstrat")
Can you provide the installation code that produced that error message? Are you trying to install it from CRAN?
That doesn't appear possible.
A post from 2014 states it's not on CRAN
quantstrat is a R package ... still under heavy development and can’t be installed from CRAN yet. You can install it from source and the process is straightforward.
It's not on the current list of available CRAN packages
It's R-Forge page states the current version 'Failed to build'.
You could download the previous version (and its dependency) from R-Forge at
http://download.r-forge.r-project.org/bin/windows/contrib/3.2/quantstrat_0.9.1739.zip and
http://download.r-forge.r-project.org/bin/windows/contrib/3.2/blotter_0.9.1741.zip
(or get the Linux tar.gz files). Assuming they're saved in your personal Downloads folder, install it in R with
install.packages("~/Downloads/blotter_0.9.1741.zip", repos = NULL)
install.packages("~/Downloads/quantstrat_0.9.1739.zip", repos = NULL)
According to that first link, you'll need to install these prereqs first, if they're not already:
install.packages("FinancialInstrument")
install.packages("PerformanceAnalytics")
install.packages("foreach")
Edit: see the comment below from #brian-g-peterson for how the current deployment avenue uses GitHub. https://github.com/braverock/quantstrat
Is it possible to install a package without installing dependencies?
When run the following command:
install.packages("package",dependencies=FALSE)
if the dependencies are not installed beforehand, isn't it that the installation of the package fails?
My question comes from this post Install a local R package with dependencies from CRAN mirror. Why does it say installing a local package without installing dependencies?
if I set repos=NULL it correctly tries to install the local package
file (as documented), but obviously it does not find the dependencies
packages.
Thanks!
You cannot install and get a package to work without its dependencies. The dependencies= parameter is really an indicator if you would like R to automatically install the dependencies. If set to FALSE, R still stop and warn you so you can decide what you would like to do; if TRUE, R will automatically try to download from your current CRAN repository mirror. With repos=NULL (a local file install) there is nowhere else to look for dependencies so the dependencies= parameter is ignored.