p_boot: Script Header: Ensure 'pacman' is Installed

Description Usage Arguments Details Value Examples


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.


p_boot(load = TRUE, copy2clip = interactive())



logical. If TRUE ; library(pacman) is added to the end of the script header.


logical. If TRUE attempts to copy the output to the clipboard.


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.


Returns a script header string (optionally copies to the clipboard).



Search within the pacman package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.