paste(nrow(available.packages()),
"packages on CRAN on",
Sys.Date())
[1] "20610 packages on CRAN on 2024-03-26"
Department of Mathematics
University of Manitoba*
R
assignments!R
by providing functions or data that are useful in particular contextsR
core remains relatively light and you only install the additional content you needinstall.packages()
devtools
or remotes
packages (maybe prefer devtools
)or we can point directly to the link
library()
library(ggplot2)
To load several packages with a single command, you need to use a loop and the option character.only = TRUE
If you use a slightly unusual library, it is possible that a person you share your code with does not have that library installed
But it is also possible that they already have the library
So test whether the library is installed
require
is designed for use inside other functions; it returnsFALSE
and gives a warning (rather than an error aslibrary()
does by default) if the package does not exist.
ask = FALSE
: do not ask for confirmationcheckBuilt = TRUE
: check with which version of R
the package was built and call package old if this is a earlier major version (e.g., built with 4.2 when the current is 4.3)Ncpus = 6
: run compilations (if needed) using that many threadsR
major versionsR
(currently 4.3)When the major version changes, you therefore need to do something with all your current packages..
There is no planned mechanisms for doing this!
Easiest: export list of libraries in the previous version, then install all of them
Set lib
to be previous R version (the one prior to the update), say, 4.2:
then get list of packages
then use the method described earlier to install all these packages