Dear list memmbers, I would like to load a R library from a specified folder with library() and need help on how to call the command. The reason is that I am loading this library on a remote machine where I have no admin rights. Furthermore a library with the same name is already installed on that machine. I have modified this library slightly by modifying the source code and created a "personal" version of this library that I now want to load instead of the standart one. Running: R CMD INSTALL 'path*/*packagename* --library=*path*/Software/R-packages i managed to compile my modified version on the remote machine and save the library in a folder on that machine. When I now start R and run library(packagename) R still seem to load the version installed on the remote computer, even though i added my folder to the library path of R by running: .libPaths("*path*/Software/R-Packages") Probably this is due to the fact that the package is also available in the standart library of R. Ist there any way of loading the Package from only one specified path? I read the help for library() and could imagine that lib.loc could be the key to sucess but am not sure which argument it needs? Thanks a lot Jannis
Duncan Murdoch
2010-Mar-30 11:16 UTC
[R] library(): load library from a specified location
On 30/03/2010 7:01 AM, Jannis wrote:> Dear list memmbers, > > > I would like to load a R library from a specified folder with library() > and need help on how to call the command. > > The reason is that I am loading this library on a remote machine where I > have no admin rights. Furthermore a library with the same name is > already installed on that machine. I have modified this library slightly > by modifying the source code and created a "personal" version of this > library that I now want to load instead of the standart one. > > Running: > > R CMD INSTALL 'path*/*packagename* --library=*path*/Software/R-packages > > > i managed to compile my modified version on the remote machine and save > the library in a folder on that machine. > > > When I now start R and run > > library(packagename) > > > R still seem to load the version installed on the remote computer, even > though > i added my folder to the library path of R by running: > > .libPaths("*path*/Software/R-Packages") > > Probably this is due to the fact that the package is also available in > the standart library of R. > Ist there any way of loading the Package from only one specified path? I > read the help for library() and could imagine that lib.loc could be the > key to sucess but am not sure which argument it needs?Is the package loaded before you make the change to .libPaths? The base packages are loaded at startup, but this can be suppressed: see ?Startup. If that's not it, then I think we need more specific information, because what you're doing should work. Show us the result of sessionInfo() .libPaths("*path*/Software/R-Packages") .libPaths() library(packagename) sessionInfo() Duncan Murdoch
Sorry folks! My way worked already! I was just too blind to realize. Treat this post as solved. Anybody trying to achieve the same as me is adviced to try the way I described in my earlier post! And thanks a lot for the advice I already recievd. Cheers Jannis