Learn R Programming

easypackages (version 0.1.0)

package: package()

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

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

Run this code
## 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)

Run the code above in your browser using DataLab