Description Usage Arguments Details Examples
This function will make sure a specified package is available within the current R session. If the package is not available it will attempt to install it and load it thereafter. If its already installed it will only load the package.
1 2 3 4 5 6 7 8 9 10 | wb_require(
pkg,
library_path = getOption("wb_require_lib_path", NULL),
date = getOption("wb_require_date", NULL),
date_shift = getOption("wb_require_shift_date", NULL),
package_path = getOption("wb_require_package_path", NULL),
dependencies = getOption("wb_require_dependencies", c("Depends", "Imports",
"LinkingTo")),
url_fun = getOption("wb_require_url", wb_repo_url)
)
|
pkg |
|
library_path |
|
date |
|
date_shift |
|
package_path |
|
dependencies |
|
url_fun |
function transforming a date into a repository url |
Other than the normal install.packages
function this function will not
use the newest package available but one that was available at a specific
point in time on CRAN. For CRAN snapshots the Microsoft R Open snapshots and
the checkpoint package are used.
The default date is the date of the release of the R version currently in use plus an additional 60 days.
The lib_path
argument can be used to make use a project specific
R package library path.
Also, its possible to specify a path were binary packages can be found and installed from.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Not run:
# set options
options(wb_require_lib_path = "./r_lib_path")
# make sure package is available
wb_require("data.table")
# use packages released up to 365 days younger than the current R-versions
# release date
wb_require("data.table", date_shift = 365)
# use a specific lib path for loading and installing
wb_require("data.table", lib_path = "./r_lib_path")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.