Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing roxygen issues in RMD Check #510

Merged
merged 7 commits into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pkg/caret/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ S3method(oob_pred,sbf)
S3method(oob_pred,train)
S3method(parallelplot,resamples)
S3method(pcaNNet,formula)
S3method(plot,prcomp.resamples)
S3method(plsda,default)
S3method(posPredValue,default)
S3method(posPredValue,matrix)
Expand Down Expand Up @@ -109,7 +110,6 @@ S3method(print,confusionMatrix.rfe)
S3method(print,confusionMatrix.sbf)
S3method(print,confusionMatrix.train)
S3method(print,diff.resamples)
S3method(print,dummyVars)
S3method(print,expoTrans)
S3method(print,gafs)
S3method(print,icr)
Expand Down Expand Up @@ -153,9 +153,12 @@ S3method(splsda,default)
S3method(stripplot,rfe)
S3method(stripplot,train)
S3method(summary,bag)
S3method(summary,diff.resamples)
S3method(summary,resamples)
S3method(train,default)
S3method(train,formula)
S3method(trim,train)
S3method(update,rfe)
S3method(varImp,C5.0)
S3method(varImp,JRip)
S3method(varImp,PART)
Expand Down Expand Up @@ -195,8 +198,6 @@ export(F_meas)
export(LPH07_1)
export(LPH07_2)
export(MeanSD)
export(R2)
export(RMSE)
export(SLC14_1)
export(SLC14_2)
export(anovaScores)
Expand Down Expand Up @@ -305,7 +306,6 @@ export(pickVars)
export(plot.calibration)
export(plot.gafs)
export(plot.lift)
export(plot.prcomp.resamples)
export(plot.rfe)
export(plot.safs)
export(plot.train)
Expand Down Expand Up @@ -358,8 +358,6 @@ export(splsda)
export(sumDiss)
export(summary.bagEarth)
export(summary.bagFDA)
export(summary.diff.resamples)
export(summary.resamples)
export(summary.train)
export(svmBag)
export(tolerance)
Expand All @@ -373,7 +371,6 @@ export(twoClassSim)
export(twoClassSummary)
export(upSample)
export(update.gafs)
export(update.rfe)
export(varImp)
export(var_seq)
export(well_numbered)
Expand Down
5 changes: 3 additions & 2 deletions pkg/caret/R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,14 @@ best <- function(x, metric, maximize)
bestIter
}


#' @export
defaultSummary <- function(data, lev = NULL, model = NULL)
{
if(is.character(data$obs)) data$obs <- factor(data$obs, levels = lev)
postResample(data[,"pred"], data[,"obs"])
}


#' @rdname postResample
#' @importFrom ModelMetrics auc
#' @export
twoClassSummary <- function (data, lev = NULL, model = NULL)
Expand All @@ -250,6 +249,7 @@ twoClassSummary <- function (data, lev = NULL, model = NULL)
out
}

#' @rdname postResample
#' @importFrom stats complete.cases
#' @export
mnLogLoss <- function(data, lev = NULL, model = NULL){
Expand All @@ -266,6 +266,7 @@ mnLogLoss <- function(data, lev = NULL, model = NULL){
ModelMetrics::mlogLoss(dataComplete$obs, probs)
}

#' @rdname postResample
#' @export
multiClassSummary <- function (data, lev = NULL, model = NULL){
#Check data
Expand Down
1 change: 1 addition & 0 deletions pkg/caret/R/bagEarth.R
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ print.bagEarth <- function (x, ...)
#' summary(fit)
#' }
#'
#' @method summary bagEarth
#' @export summary.bagEarth
"summary.bagEarth" <-
function(object, ...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/caret/R/calibration.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#'
#' @param lattice.options A list that could be supplied to \code{\link[lattice:lattice.options]{lattice#' .options}}
#'
#' @param bwidth, dwidth a numeric value for the confidence interval bar width and dodge width, respective#' ly. In the latter case, a dodge is only used when multiple models are specified in the formula.
#' @param bwidth,dwidth a numeric value for the confidence interval bar width and dodge width, respective#' ly. In the latter case, a dodge is only used when multiple models are specified in the formula.
#' @param \dots options to pass through to \code{\link[lattice:xyplot]{xyplot}} or the panel function (not #' used in \code{calibration.formula}).
#'
#' @details
Expand Down
82 changes: 40 additions & 42 deletions pkg/caret/R/dummyVar.R
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
#' @export
contr.ltfr <- function (n, contrasts = TRUE, sparse = FALSE)
{
if (is.numeric(n) && length(n) == 1L) {
if (n > 1L)
levels <- as.character(seq_len(n))
else stop("not enough degrees of freedom to define contrasts")
}
else {
levels <- as.character(n)
n <- length(n)
}
contr <- .RDiag(levels, sparse = sparse)
if (contrasts) {
if (n < 2L) stop(gettextf("contrasts not defined for %d degrees of freedom", n - 1L), domain = NA)
}
contr
}

#' @export
contr.dummy <- function(n, ...)
{
if (is.numeric(n) && length(n) == 1L) {
if (n > 1L)
levels <- as.character(seq_len(n))
else stop("not enough degrees of freedom to define contrasts")
}
else {
levels <- as.character(n)
n <- length(n)
}
out <- diag(n)
rownames(out) <- levels
colnames(out) <- levels
out
}



#' Create A Full Set of Dummy Variables
#'
#' \code{dummyVars} creates a full set of dummy variables (i.e. less than full
Expand Down Expand Up @@ -88,9 +49,6 @@ contr.dummy <- function(n, ...)
#' @param contrasts A logical indicating whether contrasts should be computed.
#' @param sparse A logical indicating if the result should be sparse.
#' @param x A factor vector.
#' @param drop2nd A logical: when the factor \code{x} has two levels, should
#' both dummy variables be returned (\code{drop2nd = FALSE} or only the dummy
#' variable for the first level \code{drop2nd = TRUE}.
#' @param ... additional arguments to be passed to other methods
#' @return The output of \code{dummyVars} is a list of class 'dummyVars' with
#' elements \item{call }{the function call} \item{form }{the model formula}
Expand Down Expand Up @@ -205,6 +163,8 @@ dummyVars.default <- function (formula, data, sep = ".", levelsOnly = FALSE, ful

}

#' @rdname dummyVars
#' @method predict dummyVars
#' @export
print.dummyVars <- function(x, ...)
{
Expand Down Expand Up @@ -269,4 +229,42 @@ predict.dummyVars <- function(object, newdata, na.action = na.pass, ...)
x[, colnames(x) != "(Intercept)", drop = FALSE]
}

#' @rdname dummyVars
#' @export
contr.ltfr <- function (n, contrasts = TRUE, sparse = FALSE)
{
if (is.numeric(n) && length(n) == 1L) {
if (n > 1L)
levels <- as.character(seq_len(n))
else stop("not enough degrees of freedom to define contrasts")
}
else {
levels <- as.character(n)
n <- length(n)
}
contr <- .RDiag(levels, sparse = sparse)
if (contrasts) {
if (n < 2L) stop(gettextf("contrasts not defined for %d degrees of freedom", n - 1L), domain = NA)
}
contr
}

#' @export
contr.dummy <- function(n, ...)
{
if (is.numeric(n) && length(n) == 1L) {
if (n > 1L)
levels <- as.character(seq_len(n))
else stop("not enough degrees of freedom to define contrasts")
}
else {
levels <- as.character(n)
n <- length(n)
}
out <- diag(n)
rownames(out) <- levels
colnames(out) <- levels
out
}


2 changes: 1 addition & 1 deletion pkg/caret/R/extractPrediction.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#' @rdname predict.train
#' @export
extractPrediction <- function(models,
testX = NULL,
Expand Down
2 changes: 1 addition & 1 deletion pkg/caret/R/extractProb.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## TODO use foreach to parallelize

#' @rdname predict.train
#' @importFrom utils flush.console
#' @export
extractProb <- function(models,
Expand Down
3 changes: 0 additions & 3 deletions pkg/caret/R/filterVarImp.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#' @importFrom ModelMetrics auc


#' @importFrom ModelMetrics auc

rocPerCol <- function(dat, cls){
auc(cls, dat)
}
Expand Down
12 changes: 10 additions & 2 deletions pkg/caret/R/gafs.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ gafs_initial <- function (vars, popSize, ...) {
x
}

#' @rdname gafs_initial
#' @export
gafs_lrSelection <- function (population, fitness,
r = NULL,
Expand All @@ -169,6 +170,7 @@ gafs_lrSelection <- function (population, fitness,
out
}

#' @rdname gafs_initial
#' @export
gafs_spCrossover <- function (population, fitness, parents, ...) {
fitness <- fitness[parents]
Expand All @@ -193,6 +195,7 @@ gafs_spCrossover <- function (population, fitness, parents, ...) {
out
}

#' @rdname gafs_initial
#' @export
gafs_raMutation <- function (population, parent, ...) {
mutate <- parent <- as.vector(population[parent, ])
Expand All @@ -202,6 +205,7 @@ gafs_raMutation <- function (population, parent, ...) {
mutate
}

#' @rdname gafs_initial
gafs_nlrSelection <- function (population, fitness, q = 0.25, ...) {
popSize <- nrow(population)
rank <- (popSize + 1) - rank(fitness, ties.method = "random")
Expand All @@ -213,6 +217,7 @@ gafs_nlrSelection <- function (population, fitness, q = 0.25, ...) {
return(out)
}

#' @rdname gafs_initial
#' @export
gafs_rwSelection <- function (population, fitness, ...) {
popSize <- nrow(population)
Expand All @@ -224,6 +229,7 @@ gafs_rwSelection <- function (population, fitness, ...) {
return(out)
}

#' @rdname gafs_initial
#' @export
gafs_tourSelection <- function (population, fitness, k = 3, ...) {
popSize <- nrow(population)
Expand All @@ -237,6 +243,7 @@ gafs_tourSelection <- function (population, fitness, k = 3, ...) {
return(out)
}

#' @rdname gafs_initial
#' @importFrom stats runif
#' @export
gafs_uCrossover <- function (population, parents, ...) {
Expand All @@ -252,6 +259,7 @@ gafs_uCrossover <- function (population, parents, ...) {
###################################################################
##

#' @rdname safsControl
#' @export
gafsControl <- function(functions = NULL,
method = "repeatedcv",
Expand Down Expand Up @@ -865,8 +873,7 @@ gafs <- function (x, ...) UseMethod("gafs")
#' and without each predictor be calculated?
#' @param gafsControl a list of values that define how this function acts. See
#' \code{\link{gafsControl}} and URL.
#' @param list() arguments passed to the classification or regression routine
#' specified in the function \code{gafsControl$functions$fit}
#' @param ... additional arguments to be passed to other methods
#' @return an object of class \code{gafs}
#' @author Max Kuhn, Luca Scrucca (for GA internals)
#' @seealso \code{\link{gafsControl}}, \code{\link{predict.gafs}},
Expand Down Expand Up @@ -1159,6 +1166,7 @@ gafs <- function (x, ...) UseMethod("gafs")
#' summary(plot_data)
#' }
#'
#' @method plot gafs
#' @export plot.gafs
plot.gafs <- function(x,
metric = x$control$metric["external"],
Expand Down
2 changes: 2 additions & 0 deletions pkg/caret/R/ggplot.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#' @rdname plot.train
#' @importFrom stats as.formula
#' @export
ggplot.train <- function(data = NULL, mapping = NULL, metric = data$metric[1], plotType = "scatter", output = "layered",
Expand Down Expand Up @@ -141,6 +142,7 @@ ggplot.train <- function(data = NULL, mapping = NULL, metric = data$metric[1], p
out
}

#' @rdname plot.rfe
#' @export
ggplot.rfe <- function(data = NULL, mapping = NULL, metric = data$metric[1],
output = "layered", ..., environment = NULL)
Expand Down
4 changes: 4 additions & 0 deletions pkg/caret/R/icr.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ icr.formula <- function (formula, data, weights, ...,
res
}

#' @rdname icr.formula
#' @method icr default
#' @importFrom stats predict lm
#' @export
icr.default <- function(x, y, ...)
Expand Down Expand Up @@ -132,6 +134,8 @@ print.icr <- function (x, digits = max(3, getOption("digits") - 3), ...)
invisible(x)
}

#' @rdname icr.formula
#' @method predict icr
#' @importFrom stats .checkMFClasses delete.response model.frame model.matrix predict na.omit fitted
#' @export
predict.icr <- function(object, newdata, ...)
Expand Down
Loading