require(pacman)

rfSRC_imp <- function(x, y, ...) {
	p_load(randomForestSRC)
	data = data.frame(x, y)
	fit <- randomForestSRC::rfsrc(y ~ ., data = data,na.action="na.impute", ...)
  
	imp = randomForestSRC::vimp(fit, importance = "random")$importance
	if (class(y) == 'factor') {
	  errRank = imp_measure(imp[,'all'])
	  imp = imp[, 'all']
	} else {
	  errRank = imp_measure(imp)
	  imp = imp
	}
	return(list(errRank = errRank, 
	            oimp = imp,
	            imp = imp_scale(imp)
	            ))
}
