package: package()

Description Usage Arguments Details Examples

View source: R/package.R

Description

A package object that contains at minimum the name of a package. If the package exists on CRAN, the name of the package is used to install that package from CRAN. A forward slash may be used in the package name to indicate a GitHub username and repo that a package is located in. A dollar sign may be used in the package name to indicate a Bitbucket username and repo that a package is located in.

Usage

1
package(name, install = utils::install.packages, ..., load_type = "attach")

Arguments

name

the name of a package, or, if the package is on Github, the username and repo of the package, ex. Rdatatable/data.table, where Rdatatable is the GitHub username, and data.table is the repo name. The same process works with Bitbucket, except $ is used instead of / to separate the username and repo.

install

(optional) a function used to install a package.

...

(optional) additional arguments to the install function. Another way of supplying additonal parameters to install is to use the purrr::partial function.

load_type

(default is "attach") should the package be loaded, or attached? See http://r-pkgs.had.co.nz/namespace.html to learn more.

Details

If a package is not inteded to be installed from CRAN, Github (public), or Bitbucket (public) you may optionally supply a function to the install argument that installs the package, with additional arguments to the function supplied via the ... argument.

Examples

1
2
3
4
5
6
7
## Not run: 
this_package <- package("dplyr")
github_package <- package("Rdatatable/data.table")
that_package <- package("jakePackage", devtools::install_bitbucket, 
repo = "repo", username = "user", password = "password")

## End(Not run)

Example output



easypackages documentation built on May 2, 2019, 3:35 p.m.