Open k8hertweck opened 4 years ago
Solution for specifying paths for GitHub installs here: https://stackoverflow.com/questions/24646065/how-to-specify-lib-directory-when-installing-development-version-r-packages-from
library(devtools)
withr::with_libpaths(new = "/home/user/R/x86_64-pc-linux-gnu-library/3.6", install_github('github_user/repo'))
Also this for Bioconductor packages:
if (!require(package)) {
if (!library(package)) {
BiocManager::install("package")
}
}
The hardcoded paths may present a problem for some- if you use a different version of R for example. It looks like (from the .libPaths() documentation) that some construct like:
file.path(Sys.getenv('HOME'),'R', R.version$platform, paste0(R.version$major, '.', R.version$minor))
Would do the trick.
@lakikowolfe This would be a great issue for you to tackle, as it would also give you encouragement to get to know rhino
better. Happy to talk to you more about this.
A nice explanation from @fizwit in response to a question asked via help ticket:
Install.packages() breaks because it uses the first path from .libPaths() which is always the system path. You need to specify a path to your home directory to install libraries by adding ‘lib=’ to the install.packages command. Keep a separate directory for each version of R. Keeping all your installed libraries in one directory is very bad. Libraries break with different versions of R.
Install.packages(‘libname’, lib=’/home/ahoge/R/R-version/’)
My personal recommendation is to add this to your ~/.Rprofile. It creates a library path for each version of R, and re-oreders libPahs, to put your personal path at the front. It will also create the directory if it does not exist.
# .Rprofile
homePath <- paste(sep="", "/home/", Sys.info()["user"], "/R/")
libPath <- paste(sep="", homePath, version$platform, "-library/", version$major, ".", version$minor )
dir.create(file.path(libPath), showWarnings = FALSE)
.libPaths( c( libPath, .libPaths() ) )
Add this to R tips and tricks: https://sciwiki.fredhutch.org/compdemos/R_tips_tricks/
Did this happen?
I don't think so. I assigned myself, since I handled some questions about it
@atombaby - is this addressed?
URL of existing content (a rendered, sciwiki.fredhutch.org link)
https://sciwiki.fredhutch.org/scicomputing/compute_scientificSoftware/ https://sciwiki.fredhutch.org/rModules/
Specific information requests or concerns, or specific region on page of content to refresh.
How can users install their own packages using
install_github
? There is no prompt for a personal library. Is there a workaround, or should they file a ticket for SciComp to install for them?@ GitHub username of the listed primary reviewer of the page if known