R/checkSL.R

.check.SL.library <- function(SL.library) {
	if("SL.bayesglm" %in% SL.library) tryCatch(require(arm), warning = function(...){ stop("you have selected bayesglm as a library algorithm but do not have the arm package installed")})
	if("SL.cforest" %in% SL.library) tryCatch(require(party), warning = function(...){ stop("you have selected cforest as a library algorithm but do not have the party package installed")})
	if("SL.DSA" %in% SL.library) tryCatch(require(DSA), warning = function(...){ stop("you have selected DSA as a library algorithm but do not have the DSA package installed")})
	if("SL.gam" %in% SL.library) tryCatch(require(gam), warning = function(...){ stop("you have selected gam as a library algorithm but do not have the gam package installed")})
	if("SL.gbm" %in% SL.library) tryCatch(require(gbm), warning = function(...){ stop("you have selected gbm as a library algorithm but do not have the gbm package installed")})
	if("SL.glmnet" %in% SL.library)	tryCatch(require(glmnet), warning = function(...){ stop("you have selected glmnet as a library algorithm but do not have the glmnet package installed")})
	if("SL.knn" %in% SL.library) tryCatch(require(class), warning = function(...){ stop("you have selected knn as a library algorithm but do not have the class package installed.  class is part of the VR bundle")})
	if("SL.logreg" %in% SL.library) tryCatch(require(LogicReg), warning = function(...){ stop("you have selected logreg as a library algorithm but do not have the LogicReg package installed")})
	if("SL.nnet" %in% SL.library) tryCatch(require(nnet), warning = function(...){ stop("you have selected nnet as a library algorithm but do not have the nnet package installed.  nnet is part of the VR bundle")})
	if("SL.polymars" %in% SL.library) tryCatch(require(polspline), warning = function(...){ stop("you have selected polymars or polyclass as a library algorithm but do not have the polspline package installed")})
	if("SL.randomForest" %in% SL.library) tryCatch(require(randomForest), warning = function(...){ stop("you have selected randomForest as a library algorithm but do not have the randomForest package installed")})
	if("SL.ridge" %in% SL.library) tryCatch(require(MASS), warning = function(...){ stop("you have selected lm.ridge as a library algorithm but do not have the MASS package installed.  MASS is part of the VR bundle")})
	if("SL.spls" %in% SL.library) tryCatch(require(spls), warning = function(...){ stop("you have selected spls as a library algorithm but do not have the spls package installed")})
	if("SL.step.plr" %in% SL.library) tryCatch(require(stepPlr), warning = function(...){ stop("you have selected step.plr as a library algorithm but do not have the stepPlr package installed")})
	if("SL.svm" %in% SL.library) tryCatch(require(e1071), warning = function(...){ stop("you have selected svm as a library algorithm but do not have the e1071 package installed")})
	if("SL.bagging" %in% SL.library) tryCatch(require(ipred), warning = function(...){ stop("you have selected bagging as a library algorithm but do not have the ipred package installed")})
	if("SL.bart" %in% SL.library) tryCatch(require(BayesTree), warning = function(...){ stop("you have selected bart as a library algorithm but do not have the BayesTree package installed")})
	if("SL.gbm.1" %in% SL.library) tryCatch(require(gbm), warning = function(...){ stop("you have selected gbm as a library algorithm but do not have the gbm package installed")})
	if("SL.gbm.2" %in% SL.library) tryCatch(require(gbm), warning = function(...){ stop("you have selected gbm as a library algorithm but do not have the gbm package installed")})
	if("SL.mars" %in% SL.library) tryCatch(require(mda), warning = function(...){ stop("you have selected mars as a library algorithm but do not have the mda package installed")})
	if("SL.earth" %in% SL.library) tryCatch(require(earth), warning = function(...){ stop("you have selected earth as a library algorithm but do not have the earth package installed")})
	if("SL.caret" %in% SL.library) tryCatch(require(caret), warning = function(...){ stop("you have selected caret as a library algorithm but do not have the caret package installed")})
}
ecpolley/SuperLearner_Old documentation built on May 15, 2019, 10:08 p.m.