im trying to install mgarch package from Github. I downloaded the zip file: mgarch_0.00-1.tar.gz
I tried this procedure:
install.packages('package.zip', lib='destination_directory',repos = NULL)
as said here Manually Downloading and Installing Packages in R
But didnt work
Another procedure was: How to install development version of R packages github repository
As suggested at this link i had to install devtools from Hadley.
install.packages("devtools")
library(devtools)
dev_mode(on=T)
install_github("ggplot2")
I did, and nothing happened.
As a begginer im really lost. Just want something to clear my way, because i need to run an BEKK GARCH Model.
try this
library(devtools)
install_github("vst/mgarch")
library(mgarch)
installs this package https://github.com/vst/mgarch
is that the one you want?
the syntax for install_github is (usually) install_github("username/repository") this is rather poorly documented in the ?install_github documentation
Related
I am trying to install the R package robCompositions but keep getting error messages. I have tried the following so far.
standard install
install.packages("robCompositions")
github install as suggested by the package maintainer (https://github.com/matthias-da/robCompositions)
library(devtools)
install_github("matthias-da/robCompositions", dependencies = TRUE)
download package and install from the package archive file (.zip, .tar, .gz)
unzip the downloaded package and run standard install
install.packages("C:/Users/SUHAS/Desktop/robCompositions_2.3.0", type="source", repos = NULL)
install r tools and then install package using standard install (https://cran.r-project.org/bin/windows/Rtools/)
install.rtools()
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
Sys.which("make")
## "C:\\rtools40\\usr\\bin\\make.exe"
install.packages("robCompositions", type = "source")
Any suggestions on how to resolve this issue would be much appreciated.
I am running R version R-4.0.4
First, apologies this is an answer and not a comment - I think it should be a comment but I don't yet have enough reputation points to comment.
I had a very similar problem. When researching it, I came across this page: https://cran.r-project.org/web/packages/robCompositions/index.html. It looks like robCompositions has been removed from CRAN, and the reason for that is a dependency, sROC, has been archived? I haven't yet come up with a workaround (I guess I'm hoping it will come back onto CRAN at some point soon!)
I am trying to install mvpart and MVPARTwrap packages in R version 3.6.1.
I install on my PC the folder of these two packages in zip version and load them in the relative folder of the package.
When I run the script library(mvpart) I get this message:
ERROR: 'mvpart' package was built before R 3.0.0: please reinstall it."
I try to load this library in the old version of R (version 2.15) and the message is
in install.packages (mvpart): object 'mvpart' not found".
I do not understand why it is impossible to load this package. Thanks so much.
Maybe the answer is no more relevant, but I just had to install those libraries so maybe it will still help someone later. I suggest the install from github as it will install dependencies, you need however to be able to compile the source. So here we go :
first install rtools if it is not already installed go here and follow the instruction
update/install devtools if necessary as described here
using this command, it should work now. you may be asked to update some packages, accept all
devtools::install_github("cran/mvpart")
Suppose I have an R package on GitHub. Is there any way, I can have an RStudio user of my package avoid first running:
install.packages("devtools")
library(devtools)
and just directly use:
install_github("My-Github-username/My-package-name")
library(My-package-name)
Can I for example make any changes to my R package such that my package automatically does install.packages("devtools") and library(devtools) for the user?
You somehow need to get your user to install and build the package locally to use it. The package can't install itself. Think of the package as a collection of code. You somehow need to get the code from GitHub to your user's computer.
If using devtools is not an option, you could have them do this manually (by, say, downloading the .tar.gz from GitHub) and then build the package themselves, using R CMD build and R CMD install such. There are some nice explanations out there on how to go about doing this. Using devtools::install_github() is a convenient, easy function that takes care of all of those steps for you.
(The exception to my statement "The package can't install itself" is that you can use devtools to install devtools.)
I'm trying to install the 'yaml' and 'stringi' packages in R-Studio, and it keeps giving me these errors:
> install.packages("stringi")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘stringi’
These will not be installed
or
> install.packages('yaml')
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘yaml’
These will not be installed
How can I get these to install properly?
The error is due to R being unable to find a binary version of the package on CRAN, instead only finding a source version of the package and your Windows installation being unable to compile it. Usually this doesn't occur, but in this case was caused by the (temporary) outage of some of the mirrors at CRAN. If you type:
> getOption('repos')
CRAN CRANextra
"http://cran.rstudio.com" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
You will see that R uses "http://cran.rstudio.com" by default to look for a package to download. If you see the cran mirrors web page you can see at the top that "http://cran.rstudio.com" actually redirects you to different servers world wide (I assume according to the geo location).
When I had the above issue, I solved it by manually changing the repo to one of the urls in the link provided. I suggest you use a different country (or even continent) in case you receive the above error.
I provide below some of the urls in case the link above changes:
Brazil http://nbcgib.uesc.br/mirrors/cran/
Italy http://cran.mirror.garr.it/mirrors/CRAN/
Japan http://cran.ism.ac.jp/
South Africa http://r.adu.org.za/
USA https://cran.cnr.Berkeley.edu/
You need to run the function install.packages as follows:
install.packages('<package_name>', repo='http://nbcgib.uesc.br/mirrors/cran/')
#or any other url from the list or link
One of them should then work to install a binary from an alternative mirror.
You need to install RTools to build packages like this (i.e., a source package rather than a binary). After you install Rtools, then try again to install.packages("ggplot2") and R will prompt you with:
Do you want to attempt to install these from source?
y/n:
(see the picture below)
You need to answer y and it will try to compile the package so it can be installed.
Struggled with this issue today, solved it for now by first downloading the windows binary and then installing e.g.
install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/stringi_1.1.1.zip", repos =NULL)
Just go to https://cran.r-project.org/ and then R Binaries/Windows/contrib and copy the url as argument to install.packages()
Install the package from a zip file - downloadable from the r-project website.
In basic R
go to Packages
Install packages from local files.
In RStudio
go to Packages
Install packages
Install from Package Archive File.
I had this issue when using an out-of-date version of R, so no binaries were available. The simple solution was to update my version of R.
Anything worked for me, until I found out my computer had an old version of R installed. Uninstalling everything and installing the newest R version worked!
I had to download the latest version of Rtools:
Go into the downloads folder and double click it to install it.
Close and reopen any R session.
Now packages should install like normal.
However, if you still have trouble, try installing the package from source (using type="source")
Like this:
install.packages("dplyr", type="source")
I'm using more and more dev packages installed from github.
I find myself wondering if there is an easy way to update these packages?
Essentially looking for something like update.packages() equivalent for install_github() (or indeed any other repo than CRAN).
Similar question for R-forge has some ideas:
Automatically update packages installed from R-forge
Maybe the best way to do this would be to install dev packages in their own separate directory:
How to specify lib directory when installing development version R Packages from github repository
keep a tab on packages as they are installed, and try re-installing list regularly.
Any thoughts?
There are a number of packages that will do this:
#hrbrmstr recommends the dtupdate package
#jeborsel suggests adding a github repository as drat-repository via the drat package from Dirk Eddelbuettel. This will let you use update.packages() on it
You could use the pacman package to install and load the current version of a package hosted on GitHub:
pkg = c('andschar/dbreport', 'Rdatatable/data.table')
pacman::p_load_current_gh(char = pkg)
You can call install_github again to get the most recent version of the package.