View source: R/VC_library_writing.R
lib.install | R Documentation |
This family of functions can help with installing packages without the risk of installing every minor package improvement as soon as it is released.
lib.install_tarball
can install a tarball based on the
tarball location and it's dependencies (like c(dplyr = '> 5.0')
).
lib.install_if_not_compatible
can install CRAN package
depending on a condition. This is especially useful
(and used on the background) for installing the dependencies for the
tarball installation.
lib.install
can install CRAN packages into the R_MV_library,
which in return is used by lib.install_if_not_compatible
.
lib.install( package_names = NULL, lib_location = lib.location(), install_temporarily = FALSE, allow_overwrite_on_convert = FALSE, quiet = TRUE, cran_url = "http://cran.us.r-project.org" ) lib.install_if_not_compatible( package_conditions, lib_location = lib.location(), install_temporarily = FALSE, allow_overwrite_on_convert = FALSE, quiet = TRUE, cran_url = "http://cran.us.r-project.org" ) lib.install_tarball( tarball, dependencies = c(), lib_location = lib.location(), install_temporarily = FALSE, allow_overwrite_on_convert = c("tarball", "dependencies"), cran_url = "http://cran.us.r-project.org" )
package_names |
Provide a vector of package names. A version cannot be supplied. |
lib_location |
The folder where this package can be installed.
The package will first be installed in a temporary install folder
|
install_temporarily |
If FALSE, the installed packages are moved
to the R_MV_library, specified by the |
allow_overwrite_on_convert |
Can be used if you are experimenting and
you would like to overwrite the installed (tarball) package.
Only makes sense with |
quiet |
Will affect |
cran_url |
Will be passed trough to the install.packages command. |
package_conditions |
Provide a vector of package
name/'version condition' specifications. See section
'limitations for |
tarball |
The complete path to the tarball file that you would like to install. |
dependencies |
Provide the dependencies like a package version
combination: |
Nothing is returned, this function is called for it's side-effect of installing a package in the multiversion library.
package_conditions
All version specifications are allowed except for the exact version indication
(e.g. don't provide c(dplyr = '1.2.3')
). It is allowed to provide no
specification, which will match any installed version of that package.
If the condition is met, the package is skipped, which is the desired
behavior for dependencies. For an empty condition (e.g. c(dplyr = '')
),
it will only install the package when no version is installed at all.
When an installed package is converted to the R_MV_library, it would normally
show that it failed to copy the packages of which that version was already present.
This means that these packages were already converted from the temporary library
to the R_MV_library structure before, and no lib.clean_install_dir()
was performed yet.
In case you are experimenting with a self made tarball package, and you are
developing the package within the same package version,
it is some times desired to overwrite the already present installed package with a new installation.
For CRAN packages, this options doesn't make sense.
Only for lib.install_tarball
, the options TRUE
, FALSE
, and additionally
"tarball"
"dependencies"
are allowed. 'dependencies' will affect
all packages that are in the temporary installation location except for the tarball package.
'tarball' will only overwrite the tarball package.
Installing a package temporarily gives you the opportunity to test the package
before adding it to the multiversion library structure. Loading packages, including those in the
temporary library (lib.location_install_dir()
) can be done using:
lib.load(..., also_load_from_temp_lib = TRUE)
.
To clean up the installation directory, run lib.clean_install_dir()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.