add_lib(..., append = FALSE)
Prepend/append paths to the library path list, using
.libPaths
.
This function is meant to be more convenient than
.libPaths
, which requires more writing if one
wants to:
ol <- .libPaths()# called sequentially, .libPaths only add the last libraryshow( .libPaths('.') )[1] "/home/renaud/Documents/projects/pkgmaker" "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" [4] "/usr/lib/R/library"show( .libPaths(tempdir()) )[1] "/tmp/RtmpJ76dtL" "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" "/usr/lib/R/library"# restore.libPaths(ol)# .libPaths does not keep the standard user libraryshow( .libPaths() )[1] "/tmp/RtmpJ76dtL/file45b961b42189" "/home/renaud/Documents/projects/pkgmaker/pkg/lib" [3] "/home/renaud/R/i686-pc-linux-gnu-library/3.0" "/usr/local/lib/R/site-library" [5] "/usr/lib/R/site-library" "/usr/lib/R/library"show( .libPaths('.') )[1] "/home/renaud/Documents/projects/pkgmaker" "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" [4] "/usr/lib/R/library"# restore.libPaths(ol)# with add_libshow( add_lib('.') )[1] "/home/renaud/Documents/projects/pkgmaker" "/tmp/RtmpJ76dtL/file45b961b42189" [3] "/home/renaud/Documents/projects/pkgmaker/pkg/lib" "/home/renaud/R/i686-pc-linux-gnu-library/3.0" [5] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" [7] "/usr/lib/R/library"show( add_lib(tempdir()) )[1] "/tmp/RtmpJ76dtL" "/home/renaud/Documents/projects/pkgmaker" [3] "/tmp/RtmpJ76dtL/file45b961b42189" "/home/renaud/Documents/projects/pkgmaker/pkg/lib" [5] "/home/renaud/R/i686-pc-linux-gnu-library/3.0" "/usr/local/lib/R/site-library" [7] "/usr/lib/R/site-library" "/usr/lib/R/library"show( add_lib('..', append=TRUE) )[1] "/tmp/RtmpJ76dtL" "/home/renaud/Documents/projects/pkgmaker" [3] "/tmp/RtmpJ76dtL/file45b961b42189" "/home/renaud/Documents/projects/pkgmaker/pkg/lib" [5] "/home/renaud/R/i686-pc-linux-gnu-library/3.0" "/usr/local/lib/R/site-library" [7] "/usr/lib/R/site-library" "/usr/lib/R/library" [9] "/home/renaud/Documents/projects"# restore.libPaths(ol)