[adegenet-commits] r1091 - www/files
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Mar 20 13:24:47 CET 2013
Author: jombart
Date: 2013-03-20 13:24:47 +0100 (Wed, 20 Mar 2013)
New Revision: 1091
Added:
www/files/hackLib.R
Log:
added script to install libraries without admin rights
Added: www/files/hackLib.R
===================================================================
--- www/files/hackLib.R (rev 0)
+++ www/files/hackLib.R 2013-03-20 12:24:47 UTC (rev 1091)
@@ -0,0 +1,24 @@
+
+##
+## HACK TO INSTALL R PACKAGES ON WINDOWS SYSTEMS
+## WITHOUT ADMIN RIGHTS
+##
+## Thibaut Jombart, March 2013
+## tjombart at imperial.ac.uk
+##
+## usage:
+## hackLib()
+## install.packages("foo")
+##
+hackLib <- function(myPath="C:/Users/Public/Rlibs"){
+ if(file.exists(myPath)) myPath <- paste(myPath,"Rlibs", sep="/")
+ myPath <- gsub("/+", "/", myPath)
+ if(!file.exists(myPath)){
+ if(!dir.create(myPath)) stop(paste(myPath, "could not be created."))
+ }
+
+ .libPaths(myPath)
+ cat(paste("\nR library set to:",myPath,"\n"))
+ if(as.numeric(file.info(myPath)$mode)<500) warning(paste(myPath, "may not be 'writable'."))
+ return(invisible())
+}
More information about the adegenet-commits
mailing list