Type: | Package |
Title: | Package Management Tool |
Version: | 0.5.1 |
Depends: | R (≥ 3.5.0) |
Imports: | remotes, methods, stats, utils |
Suggests: | BiocManager, knitr, lattice, testthat (≥ 0.9.0), XML |
BugReports: | https://github.com/trinker/pacman/issues?state=open |
Description: | Tools to more conveniently perform tasks associated with add-on packages. pacman conveniently wraps library and package related functions and names them in an intuitive and consistent fashion. It seeks to combine functionality from lower level functions which can speed up workflow. |
License: | GPL-2 |
URL: | https://github.com/trinker/pacman |
RoxygenNote: | 6.1.1 |
NeedsCompilation: | no |
Packaged: | 2019-03-11 01:37:03 UTC; trinker |
Author: | Tyler Rinker [aut, cre, ctb], Dason Kurkiewicz [aut, ctb], Keith Hughitt [ctb], Albert Wang [ctb], Garrick Aden-Buie [ctb], Albert Wang [ctb], Lukas Burk [ctb] |
Maintainer: | Tyler Rinker <tyler.rinker@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2019-03-11 11:50:07 UTC |
Package Author
Description
Returns the author of a package.
Usage
p_author(package = "base")
Arguments
package |
Name of the package you want the author of. |
See Also
Examples
p_author(pacman)
p_author()
Base Install Packages
Description
List just base packages or list all the packages in the local library and mark those in a base install.
Usage
p_base(base.only = TRUE, open = FALSE, basemarker = "***")
Arguments
base.only |
logical. If |
open |
logical. If |
basemarker |
Character string. The string to append to mark which packages are part of the default packages. |
Note
Packages that are installed when R starts are marked with an asterisk(*).
See Also
Examples
## Not run:
p_base()
p_base(TRUE)
## End(Not run)
Script Header: Ensure pacman is Installed
Description
Generate a string for the standard pacman script header that, when added to scripts, will ensure pacman is installed before attempting to use it. pacman will attempt to copy this string (standard script header) to the clipboard for easy cut and paste.
Usage
p_boot(load = TRUE, copy2clip = interactive())
Arguments
load |
logical. If |
copy2clip |
logical. If |
Details
The script header takes the form of:
if (!require("pacman")) install.packages("pacman"); library(pacman)
This can be copied to the top of scripts to make it easy to run scripts if
the user shares them with others or to aid in long term script management.
This may also be useful for blog posts and R help sites like
TalkStats or
StackOverflow. In this
way functions like p_load
can be used without fear that others don't
have pacman installed.
Value
Returns a script header string (optionally copies to the clipboard).
Examples
p_boot()
Package Citation
Description
Generate citation for a package.
Usage
p_citation(package = "r", copy2clip = interactive(),
tex = getOption("pac_tex"), ...)
p_cite(package = "r", copy2clip = interactive(),
tex = getOption("pac_tex"), ...)
Arguments
package |
Name of the package you want a citation for. |
copy2clip |
logical. If |
tex |
logical. If |
... |
Additional inputs to |
See Also
Examples
## Not run:
p_citation()
p_cite(pacman)
p_citation(pacman, tex = FALSE)
p_citation(tex = FALSE)
p_cite(knitr)
## End(Not run)
CRAN Packages
Description
p_cran
- Generate a vector of all available packages.
p_iscran
- Logical check if a package is available on CRAN.
Usage
p_cran(menu = FALSE)
p_iscran(package)
Arguments
menu |
logical. If |
package |
Name of package. |
See Also
Examples
## Not run:
p_cran()
p_cran(TRUE)
p_iscran(pacman)
## End(Not run)
Package Data Sets
Description
Generate a script of all data sets contained in package.
Usage
p_data(package = "datasets", static = FALSE)
Arguments
package |
name of package (default is the base install datasets package). |
static |
logical. If |
Value
Returns the data sets of a package as a data.frame
.
(static = FALSE
) or as a static text file (static = TRUE
).
See Also
Examples
p_data()
p_data(lattice)
## Not run:
p_data(static=TRUE)
## End(Not run)
Permanently Remove Package Removal(s) From Library
Description
Remove package(s) from the library permanently.
Usage
p_delete(..., char, character.only = FALSE, quiet = FALSE)
p_del(..., char, character.only = FALSE, quiet = FALSE)
Arguments
char |
Character vector containing packages to load. If you are calling
|
character.only |
logical. If |
quiet |
logical. Passed to |
... |
name(s) of package(s). |
Warning
Using this function will remove the package from your library and cannot be loaded again without reinstalling the package.
See Also
Examples
## Not run:
p_delete(pacman) # You never want to run this
## End(Not run)
Package Dependencies
Description
p_depends
- Get CRAN or local
package dependencies.
p_depends_reverse
- Get CRAN or
local reverse dependencies.
Usage
p_depends(package, local = FALSE, character.only = FALSE, ...)
p_depends_reverse(package, local = FALSE, character.only = FALSE, ...)
Arguments
package |
Name of the package you want the list of dependencies/reverse dependencies for. |
local |
logical. If |
character.only |
logical. If |
... |
other arguments passed to
|
Value
Returns a list of dependencies/reverse dependencies.
See Also
p_info
,
package_dependencies
,
dependsOnPkgs
Examples
p_depends(lattice)
p_depends_reverse(lattice)
## Not run:
## dependencies from CRAN
p_depends(pacman)
p_depends_reverse("pacman")
## local dependencies
p_depends(pacman, local = TRUE)
p_depends_reverse("qdap", local = TRUE)
## End(Not run)
Detects Operating System
Description
Attempts to detect the operating system. Returns: "Windows", "Darwin" on Mac, "Linux", or "SunOS" on Solaris
Usage
p_detectOS()
Checks if Package is On CRAN/In Local Library
Description
Checks CRAN to determine if a package exists.
Usage
p_exists(package, local = FALSE)
Arguments
package |
Name of package. |
local |
logical. If |
Examples
## Not run:
p_exists(pacman)
p_exists(pacman, FALSE)
p_exists(I_dont_exist)
## End(Not run)
Convert String With Commas Into Elements
Description
p_extract
is designed to be used in conjunction with
p_information
to convert a single comma separated
string into a vector of package names.
Usage
p_extract(x, use.names = TRUE)
Arguments
x |
A character string of packages separated by commas; for example
the strings returned from |
use.names |
logical. If |
Value
Returns a character vector of packages.
See Also
Examples
## Not run:
p_extract(p_info(ggplot2, "Depends"))
p_extract(p_info(ggplot2, "Imports"))
lapply(p_info(ggplot2, "Imports", "Depends", "Suggests"), p_extract)
## End(Not run)
Package Functions
Description
List the functions from a package.
Usage
p_functions(package = "base", all = FALSE, character.only = FALSE)
p_funs(package = "base", all = FALSE, character.only = FALSE)
Arguments
package |
Name of the package you want the list of functions for. |
all |
logical. If |
character.only |
logical. If |
Examples
p_functions()
p_funs()
p_funs(pacman)
Package Help Manual
Description
Generate an html, web or pdf of a package's help manual.
Usage
p_help(package = NULL, web = TRUE, build.pdf = FALSE)
Arguments
package |
Name of package. |
web |
logical. If |
build.pdf |
logical. If |
Warning
Setting build.pdf = TRUE
requires the user to have a pdf compiler (e.g.,
MikTex or
Tex Live) installed.
References
http://r.789695.n4.nabble.com/Opening-package-manual-from-within-R-td3763938.html
See Also
Examples
## Not run:
p_help()
p_help(pacman)
p_help(pacman, web=TRUE)
p_help(pacman, build.pdf=TRUE)
## End(Not run)
Package Information
Description
Provides the information from for a package from the NAMESPACE. Information may include: title, version, author, maintainer, description, depends, imports, suggests
Usage
p_information(package = "base", ..., fields = NULL)
p_info(package = "base", ..., fields = NULL)
Arguments
package |
Name of the package to grab information for. Default is
|
... |
Names of fields (see |
fields |
A character vector giving the tags of fields to return (for use inside of functions rather than ...). |
Value
Returns a list of fields.
Note
Note that the output from p_information
(when no
fields are passed) prints pretty but is actually an accessible list (use
names(p_info())
test).
See Also
packageDescription
,
p_information
Examples
p_information()
p_info()
names(p_info())
p_info()[names(p_info())]
p_info(pacman)
p_info(pacman, Author)
p_info(pacman, BugReports, URL)
p_info(pacman, fields = "Version")
## Not run:
p_extract(p_info(ggplot2, "Depends"))
p_extract(p_info(ggplot2, "Imports"))
lapply(p_info(ggplot2, "Imports", "Depends", "Suggests"), p_extract)
## End(Not run)
Installs & Loads Packages
Description
Installs a package provided the package is a CRAN package.
Usage
p_install(package, character.only = FALSE, force = TRUE,
path = getOption("download_path"), try.bioconductor = TRUE,
update.bioconductor = FALSE, ...)
p_get(package, character.only = FALSE, force = TRUE,
path = getOption("download_path"), try.bioconductor = TRUE,
update.bioconductor = FALSE, ...)
Arguments
package |
Name of package(s). |
character.only |
logical. If |
force |
logical. Should package be installed if it already exists on local system? |
path |
The path to the directory that contains the package. It is
convenient to set |
try.bioconductor |
If |
update.bioconductor |
If |
... |
Additional parameters to pass to |
See Also
Examples
## Not run:
p_install(pacman)
## End(Not run)
Installs & Loads GitHub Packages
Description
Installs a GitHub package. A wrapper for install_github
which is the same as install_github
.
Usage
p_install_gh(package, dependencies = TRUE, ...)
Arguments
package |
Repository address(es) in the format
|
dependencies |
logical. If |
... |
Additional parameters to pass to |
See Also
Examples
## Not run:
p_install_gh("trinker/pacman")
## Package doesn't exist
p_install_gh("trinker/pacmanAwesomer")
## End(Not run)
Install Minimal Package Version
Description
Install minimal package version(s).
Usage
p_install_version(package, version)
Arguments
package |
|
version |
Corresponding |
Examples
## Not run:
p_install_version(
c("pacman", "testthat"),
c("0.2.0", "0.9.1")
)
## End(Not run)
Install Minimal GitHub Package Version
Description
Install minimal GitHub package version(s).
Usage
p_install_version_gh(package, version, dependencies = TRUE)
Arguments
package |
|
version |
Corresponding |
dependencies |
logical. If |
Examples
## Not run:
p_install_version_gh(
c("trinker/pacman", "hadley/testthat"),
c("0.2.0", "0.9.1")
)
## End(Not run)
Interactive Package Exploration
Description
Interactively search through packages, looking at functions and optionally attaching the package and looking at the help page.
Usage
p_interactive()
p_inter()
Examples
## Not run:
p_interactive()
p_inter()
## End(Not run)
Checks if Package is Installed
Description
Check if package is installed locally.
Usage
p_isinstalled(package)
Arguments
package |
Name of package you want to check. This can be quoted or unquoted. |
Examples
## Not run:
p_installed(pacman)
p_installed(fakePackage)
## End(Not run)
Display Library Packages
Description
Generates a vector of all packages available to the user and optionally opens the user's library (this isn't necessarily where all of the available packages are stored).
Usage
p_library(open = FALSE)
p_lib(open = FALSE)
Arguments
open |
logical. If |
Examples
p_lib()
p_library()
## Not run:
p_lib(TRUE)
## End(Not run)
Load One or More Packages
Description
This function is a wrapper for library
and
require
. It checks to see if a
package is installed, if not it attempts to install the package from CRAN
and/or any other repository in the pacman repository list.
Usage
p_load(..., char, install = TRUE, update = getOption("pac_update"),
character.only = FALSE)
Arguments
char |
Character vector containing packages to load. If you are calling
|
install |
logical. If |
update |
logical. If |
character.only |
logical. If |
... |
name(s) of package(s). |
See Also
library
,
require
,
install.packages
Examples
## Not run:
p_load(lattice)
p_unload(lattice)
p_load(lattice, foreign, boot, rpart)
p_loaded()
p_unload(lattice, foreign, boot, rpart)
p_loaded()
## End(Not run)
Force Install and Load One or More GitHub Packages
Description
This function is a wrapper for install_github
which is the same as install_github
and
require
. It checks to see if a
package is installed, if not it attempts to install the package from
GitHub. Use this over p_load_gh
if you
want to force install the most recent GitHub version of a package.
Usage
p_load_current_gh(..., char, update = getOption("pac_update"),
dependencies = TRUE)
Arguments
char |
Character vector containing repository address to load. If you are calling
|
update |
logical. If |
dependencies |
logical. If |
... |
Repository address(es) in the format
|
See Also
install_github
library
,
require
Examples
## Not run:
p_load_current_gh(c("Dasonk/Dmisc", "trinker/clustext", "trinker/termco"))
## End(Not run)
Load One or More GitHub Packages
Description
This function is a wrapper for install_github
which is the same as install_github
and
require
. It checks to see if a
package is installed, if not it attempts to install the package from
GitHub.
Usage
p_load_gh(..., char, install = TRUE, update = getOption("pac_update"),
dependencies = TRUE)
Arguments
char |
Character vector containing repository address to load. If you are calling
|
install |
logical. If |
update |
logical. If |
dependencies |
logical. If |
... |
Repository address(es) in the format
|
See Also
install_github
library
,
require
Examples
## Not run:
p_load_gh("Dasonk/Dmisc", "trinker/regexr")
p_load_gh(c("trinker/regexTools",
"hadley/lubridate",
"ramnathv/rCharts"))
## End(Not run)
Check for Loaded Packages
Description
p_loaded
- Output is a character string of loaded packages.
p_isloaded
- Check if package(s) is loaded.
Usage
p_loaded(..., all = FALSE, char, character.only = FALSE)
p_isloaded(...)
Arguments
all |
logical. If |
char |
Character vector containing packages to load. If you are calling
|
character.only |
logical. If |
... |
Optional package names. Adding package names will check their individual load status. |
See Also
Examples
## Not run:
p_load(lattice, ggplot2)
## End(Not run)
p_loaded()
p_loaded(all=TRUE)
p_loaded(ggplot2, tm, qdap)
p_isloaded(ggplot2)
p_isloaded(ggplot2, dfs, pacman)
## Not run: p
_unload(lattice)
## End(Not run)
Package/R News
Description
Find out news on a package or R.
Usage
p_news(package = NULL)
Arguments
package |
Name of package (default is to see news for R). |
See Also
Examples
## Not run:
p_news()
p_news(lattice)
## Grab specific version subsets
subset(p_news(lattice), Version == 0.7)
## End(Not run)
Compare Installed Packages with CRAN-like Repositories
Description
Indicates packages which have a (suitable) later version on the repositories
Usage
p_old()
Value
Retuns a data.frame
with info regarding out of data packages.
See Also
Examples
## Not run:
p_old()
## End(Not run)
Attempts to open a directory in a file browser
Description
Attempts to open a directory in a file browser. Opening a directory isn't a platform independent but it is used in more than one function so moving this functionality to its own non-exported function makes sense.
Usage
p_opendir(dir = getwd())
Arguments
dir |
A character string representing the path (either relative or absolute) to the directory to be opened. Defaults to the working directory. |
Note
Most likely this function will move to a different package at some point as it's not specifically package related.
Examples
## Not run:
p_opendir() # opens working directory
p_opendir(path.expand("~")) # opens home directory
p_opendir(pacman:::p_basepath())
## End(Not run)
Path to Library of Add-On Packages
Description
Path to library of add-on packages.
Usage
p_path(package = "R")
Arguments
package |
Name of package (default returns path to library of add-on packages). |
See Also
Examples
p_path()
p_path(pacman)
Search CRAN Packages by Maintainer, Author, Version or Package
Description
Uses agrep
to find packages by
maintainer (often this is the author as well) or by name.
Usage
p_search_any(term, search.by = "Maintainer")
p_sa(term, search.by = "Maintainer")
Arguments
term |
A search term (character string). |
search.by |
The variable to search by (takes
a integer or a character string): 1- |
Details
Useful for finding packages by the same author (usually the same as the maintainer). This function will take some time as the function is searching thousands of packages via CRAN's website.
Author(s)
BondedDust (stackoverflow.com) and Tyler Rinker <tyler.rinker@gmail.com>
References
https://cran.r-project.org/web/checks/check_summary_by_maintainer.html#summary_by_maintainer http://stackoverflow.com/a/10082624/1000343
Examples
## Not run:
p_search_any("hadley", 1)
p_sa("hadley", "author")
p_sa("color", 2)
p_sa("psych", "package")
## End(Not run)
Partial Matching Package Search
Description
Search library packages using partial matching. Search for packages by partial matching letter(s) or by any letter(s) contained within the package's name. Useful for those times when you can't remember that package name but you know “it starts with...”
Usage
p_search_library(begins.with = NULL, contains = NULL)
p_sl(begins.with = NULL, contains = NULL)
Arguments
begins.with |
A character string to search for packages starting with the letter(s). |
contains |
A character string to search for packages containing the letter(s). |
Examples
## Not run:
p_search_library(begins.with = "ma")
p_search_library(begins.with = "r", contains = "ar")
p_search_library(contains = "att")
## End(Not run)
Check if Repo is Set
Description
Check if a repo is already set and if not choose an appropriate repo.
Usage
p_set_cranrepo(default_repo = "http://cran.rstudio.com/")
Arguments
default_repo |
The default package repository. |
Install a Package Temporarily
Description
Installs and loads a package for the current session. The package won't be available in future sessions and will eventually be deleted from the machine with no additional effort needed by the user. This will also install the necessary dependencies temporarily as well.
Usage
p_temp(package, character.only = FALSE)
Arguments
package |
The package we want to install temporarily |
character.only |
logical. Is the input a character string? |
Author(s)
juba (stackoverflow.com) and Dason Kurkiewicz
References
http://stackoverflow.com/a/14896943/1003565
Unloads package(s)
Description
Unloads package(s) or all packages.
Usage
p_unload(..., negate = FALSE, char, character.only = FALSE)
Arguments
... |
name of package(s) or "all" (all removes all add on packages). |
negate |
logical. If |
char |
Character vector containing packages to load. If you are calling
|
character.only |
logical. If |
Note
p_unload
will not unload the base install packages that load
when R boots up. See the comments in the help for detach
about some
issues with unloading and reloading namespaces.
See Also
Examples
## Not run:
p_load(lattice)
p_loaded()
p_unload(lattice)
p_loaded()
p_load("lattice", "MASS")
p_loaded()
p_unload(all)
p_loaded() # will not work as you unloaded pacman
library(pacman)
p_load(lattice, MASS, foreign)
p_loaded()
p_unload(pacman, negate=TRUE)
p_loaded()
## End(Not run)
Delete 00LOCK Directory
Description
Deletes the 00LOCK directory accidentally left behind by a fail in
install.packages
.
Usage
p_unlock(lib.loc = p_path())
Arguments
lib.loc |
Path to library location. |
Details
Sometimes install.packages
can "fail so badly
that the lock directory is not removed: this inhibits any further installs to
the library directory (or for –pkglock, of the package) until the lock
directory is removed manually." p_unlock
deletes the directory
00LOCK that is left behind.
Value
Attempts to delete a 00LOCK(s) if it exists. Returns logical
TRUE
if a 00LOCK existed and FALSE
if not.
See Also
Examples
## Not run:
p_unlock()
## End(Not run)
Update Out-of-Date Packages
Description
Either view out of date packages or update out of data packages.
Usage
p_update(update = TRUE, ask = FALSE, ...)
p_up(update = TRUE, ask = FALSE, ...)
Arguments
update |
logical. If |
ask |
logical. If |
... |
Other arguments passed to |
See Also
Examples
## Not run:
p_update()
p_update(FALSE)
p_up(FALSE)
## End(Not run)
Package Version
Description
p_version
- Determine what version a package is in your library.
p_version_cran
- Determine what version a package is on CRAN.
p_version_difference
- Determine version difference between a local
package and CRAN.
Usage
p_version(package = "R")
p_ver(package = "R")
p_version_cran(package = "R")
p_ver_cran(package = "R")
p_version_diff(package = "R")
p_ver_diff(package = "R")
Arguments
package |
Name of package (default returns R version). |
See Also
Examples
## Not run:
p_ver()
p_version()
p_ver(pacman)
p_version(pacman)
p_ver_cran()
p_ver_cran(pacman)
## Compare local to CRAN version
p_ver(pacman) == p_ver_cran(pacman)
p_ver(pacman) > p_ver_cran(pacman)
p_ver_diff()
p_ver_diff(pacman)
## End(Not run)
View Package Vignette(s)
Description
Interactively view vignettes for package(s) or return a dataframe of vignettes and accompanying information.
Usage
p_vignette(..., char, interactive = TRUE, character.only = FALSE)
p_vign(..., char, interactive = TRUE, character.only = FALSE)
Arguments
char |
Character vector containing packages to find vignettes for. If
you are calling |
interactive |
logical. If |
character.only |
logical. If |
... |
name(s) of package(s). |
See Also
Examples
## Not run:
p_vignette(interactive = FALSE)
p_vignette()
p_vign()
p_vign(pacman)
p_vign(grid, utils)
p_vign(grid, utils, interactive = FALSE)
p_vign(fortunes)
## End(Not run)
Prints a p_version_diff Object
Description
Prints a p_version_diff object.
Usage
## S3 method for class 'p_version_diff'
print(x, ...)
Arguments
x |
The p_version_diff object. |
... |
ignored |
Prints a search_any Object
Description
Prints a search_any object.
Usage
## S3 method for class 'search_any'
print(x, ...)
Arguments
x |
The search_any object. |
... |
ignored |
Prints a wide_table Object
Description
Prints a wide_table object.
Usage
## S3 method for class 'wide_table'
print(x, right = FALSE, ...)
Arguments
x |
The wide_table object. |
right |
logical. If |
... |
ignored |