Description Usage Arguments Details Value Examples
View source: R/exported_functions.R
Attach packages to the search path, installing them from CRAN, GitHub, or Bioconductor if needed
1 2 3 4 5 6 7 8 9 |
... |
(Names) Packages as bare names. If the package is from GitHub, include both the username and package name as UserName/package (see examples). |
lib |
(Character) By R convention, packages are installed to the first
folder in your library search path ( |
update_all |
(Logical) If |
quiet |
(Logical) If |
ask |
(Logical) If |
cran_repo |
(Character) In RStudio, a default CRAN repo can be set via Options > Packages > Default CRAN Mirror). Otherwise, provide the URL to CRAN or one of its mirrors. If an invalid URL is given, defaults to https://cran.r-project.org. |
bioc_repo |
(Character) If you use Bioconductor, you can set the repo URLs for it here.
Defaults to Bioconductor's defaults (view them with |
You may choose to organise your library into folders to hold packages for different
tasks or projects. If you specify a lib
folder, it will be created (if needed) and
attached to the package search path. R will look for packages by working through the
package search path in order. You can view the folders that are on this path by
calling lib_paths()
with no arguments.
If you specify a new lib
and use the argument update_all = TRUE
to force an
already-installed package to reinstall, a new copy of that package will be made in
lib
and then loaded from there. This means that you can potentially have several
copies of the same package across many folders on your machine, each a different
version. This allows you to maintain a different library folder for different projects,
so that updated packages in Project B will not affect the package versions you rely on
for Project A.
Invisibly returns a named logical vector, where the names are the packages
requested in ...
and TRUE
means that the package was successfully installed
and attached.
1 2 3 4 5 6 7 8 | shelf(fortunes, DesiQuintans/emptyRpackage, cowsay, lib = tempdir(), update_all = TRUE)
# shelf() returns invisibly; bind its output to a variable or access the .Last.value.
print(.Last.value)
#> fortunes emptyRpackage cowsay
#> TRUE TRUE TRUE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.