character vector giving the library directories where to install the packages. Recycled as needed. If missing, defaults to the first element of .libPaths() .
while destdir is the
directory where downloaded packages are stored. If it is NULL (the default) a subdirectory downloaded_packages of the session temporary directory will be used (and the files will be deleted at the end of the session).
It seems to me like both of these are the path where the package is installed. What is the difference?
Similarly, which does lib.loc in library() correspond to? That is, will the path given to lib.loc be the same as the path for lib or for destdir?
This is where the "intermediate" installation files are downloaded, either the source file or precompiled binaries which are only needed temporarily for the installation process, that is why the documentation states: "...the files will be deleted at the end of the session)."
This is the location of your package library, where the packages get installed.
Thank you for clarifying. I'm still confused because when I pass the lib directory to library() I'm told there is no package, even though the file (compressed folder) clearly exists.
> install.packages("units", lib = "libs")
> list.files("libs")
# "units_0.7-2.tar.gz"
> library(units, lib.loc = "libs")
# Error in library(units, lib.loc = "libs") :
# there is no package called ‘units’
This makes me feel like I'm putting the wrong file in my library folder.
Should the lib.loc directory contain TAR files?
Should I be giving library() the specific file name?
Really, just why is R telling me the package doesn't exist when I see it listed?