Install R-Package from Github

Install R packages from github downloading master.zip

This answer is just a refined version of my comments. Essentially you can install packages using devtools by unzipping a local zipfile downloaded from github, and then running the install function


install("path/to/unzipped_pkg_zip_file")

The latest dev version of devtools contains an install_local utility function that makes it easy to work directly with local zip files.

how do you install R packages from a private git repo with a PAT?

My go to :

gitcred <- git2r::cred_user_pass(username="$(USERNAME)",password="$(PAT)")
#here you can put any private repo such as devops azure or bitbucket, etc..
remotes::install_git("https://dev.azure.com/XXX", credentials = gitcred)'

install R package from github using conda

According to this: https://github.com/conda/conda/issues/6674
You can create your own conda skeleton of a github derived R-package much as you would for a CRAN package.

Try doing

conda skeleton cran <github_url>

conda build --R=<my_r_version> r-<lower-case-package-name>

Then upload the built conda package to your own anaconda repository.
This will fail if any of the dependencies of the package are absent from the anaconda repos that you have access to. So you might have to conda-build a few other packages along the way.

Alternatively, you could install it directly with devtools::install_github(github_url, dependencies = FALSE). If you do go down this route, please ensure that any conda-available dependencies for the github package are already installed.

If you don't use dependencies = FALSE R will install.packages a bunch of updates. (As far as I can tell) When you install.packages a pre-installed package some_package in a conda env (eg, to update it) and then check conda list <some_package> on your current env, it will show the version that was installed by conda, rather than the updated version.


Edited build command, following @rpanai s suggestion

Install package from github private repo without personal access token

You could add others as collaborators on your private repo, then they could use their own PAT to access the repo. It's not great idea to share PAT so this way each party is responsible for their own. That will also allow you to easily remove individuals without affecting access for everyone.



Related Topics



Leave a reply



Submit