Reputation: 437
Hello I am trying to add a new path to .libPath() in RStudio in Windows. But it doesn't get added to it. Can someone please help me.
> .libPaths()
[1] "C:/Users/ars/Documents/R/R-3.5.1/library"
> .libPaths(c(.libPaths(), "C:/Users/ars/Documents/R/win-library/3.4/"))
> .libPaths()
[1] "C:/Users/ars/Documents/R/R-3.5.1/library"
>
Upvotes: 1
Views: 980
Reputation: 5788
path.expand("~")
.First <- function() {
path_to_libraries <- ""
.libPaths(c(path_to_libraries, .libPaths()))
}
Upvotes: -1
Reputation: 1562
Remove the trailing slash. From ?.libPaths
:
How paths new with a trailing slash are treated is OS-dependent. On a POSIX filesystem existing directories can usually be specified with a trailing slash: on Windows filepaths with a trailing slash (or backslash) are invalid and so will never be added to the library search path.
Upvotes: 3