Skip to content
/ needs Public

An R function for safe package loading / installation.

License

Notifications You must be signed in to change notification settings

joshkatz/needs

Repository files navigation

needs

CRAN_Status_Badge

needs is a simple R package to make package loading / installation hassle-free — use it in place of library to attach packages and automatically install any that are missing. You can also supply a minimum version number, and it will update old packages as needed. No more changing your code to reinstall packages every time you update R — needs does it for you.

install.packages("needs")
# for the dev version:
# devtools::install_github("joshkatz/needs", ref = "development")
library(needs)

# answer "yes" when prompted, and you will never have
# to type library or install.packages again. hooray.

Usage

Once installed, use just as you would library. With the added bonus of being able to give multiple unquoted arguments in one single function call. Specify a required package version with a pairlist:

needs(foo,
      bar = "0.9.1",
      baz = "0.4.3")

Rprofile

needs can help make code-sharing easier. In your project directory:

needs::toProfile()

This extracts the package contents and appends it to the Rprofile in your working directory. Now if someone else clones your project, your code runs without requiring any extra installation or throwing errors for uninstalled packages.

About

An R function for safe package loading / installation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published