How to specify lib directory when installing development version R Packages from github repository
To add specified library paths in devtools
, we need to use with_libpaths()
Arguments for with_libpaths()
are, with_libpaths(new, code)
Following is an example for using with_libpaths()
,
library(devtools)
with_libpaths(new = "/usr/lib/R/site-library/", install_github('rCharts', 'ramnathv'))
Courtesy: Hadley, here :)
And other than with_libpaths()
, there are more options for in devtools::with_something()
in_dir: working directory
with_collate: collation order
with_envvar: environmental variables
with_libpaths: library paths, replacing current libpaths
with_lib: library paths, prepending to current libpaths
with_locale: any locale setting
with_options: options
with_path: PATH environment variable
with_par: graphics parameters
More explanations here
How to install development version of R packages github repository
via Hadley at https://github.com/hadley/ggplot2
install.packages("devtools")
library(devtools)
dev_mode(on=T)
install_github("hadley/ggplot2")
# use dev ggplot2 now
# when finished do:
dev_mode(on=F) #and you are back to having stable ggplot2
Install a github package alongside a CRAN package with the same name?
You can use devtools::dev_mode()
for this. From the man page:
When activated, dev_mode creates a new library for storing installed packages. This new library is automatically created when dev_mode is activated if it does not already exist. This allows you to test development packages in a sandbox, without interfering with the other packages you have installed.
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)'
Related Topics
How to Request an Early Exit When Knitting an Rmd Document
Passing String Variable Facet_Wrap() in Ggplot Using R
How to Remove Multiple Columns in R Dataframe
Email Dataframe as Table in Email Body with Sendmailr
Delete Columns Where All Values Are 0
Change the Color of the Axis Labels
Why Is Foreach() %Do% Sometimes Slower Than For
How to Convert Entire Dataframe to Numeric While Preserving Decimals
How to Plot One Variable in Ggplot
How to Swap Columns Around in a Data Frame Using R
Get Filename and Path of 'Source'D File
Using Geo-Coordinates as Vertex Coordinates in the Igraph R-Package
How to Find the Polygon Nearest to a Point in R
Use Pipe Without Feeding First Argument
Is Data Really Copied Four Times in R's Replacement Functions