R/helperfunctions.R

Defines functions requireLibrary

Documented in requireLibrary

requireLibrary <- function(package) {
	if(!require(package, character.only=TRUE)) {
		answer <- readline(paste("Package ",package," is required - should we install it?",sep=""))
		if (substr(answer, 1, 1) %in% c("y","Y")) {
			install.packages(package)
			require(package, character.only=TRUE)
		} else {
			stop(paste("Required package",package,"should not be installed"))
		}
	}
}

Try the mutoss package in your browser

Any scripts or data that you put into this service are public.

mutoss documentation built on May 2, 2019, 5:56 p.m.