# This file is automatically generated, you probably don't want to edit this
caretOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"caretOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
dep = NULL,
covs = NULL,
facs = NULL,
trans = "bagImpute",
method = "pls",
cm1 = "ctree",
mecon = "cv",
number = 10,
repeats = 5,
tune = 10,
per = 0.7,
over1 = TRUE,
over = FALSE,
cla = FALSE,
cla1 = FALSE,
tra = TRUE,
tes = FALSE,
plot = FALSE,
plot1 = FALSE,
plot2 = FALSE,
plot3 = FALSE,
plot4 = FALSE,
plot5 = FALSE,
plot6 = FALSE,
plot7 = FALSE,
ml = "pls,ctree,knn,rf",
me = "cv",
num = 10,
rep = 5,
tune1 = 10,
accu = FALSE,
kapp = FALSE,
width = 500,
height = 500,
width1 = 500,
height1 = 500,
width2 = 500,
height2 = 500,
width3 = 500,
height3 = 500,
width4 = 500,
height4 = 500,
width5 = 500,
height5 = 500,
width6 = 500,
height6 = 500,
width7 = 500,
height7 = 500,
plot8 = FALSE,
width8 = 500,
height8 = 500, ...) {
super$initialize(
package="snowCluster",
name="caret",
requiresData=TRUE,
...)
private$..dep <- jmvcore::OptionVariable$new(
"dep",
dep,
suggested=list(
"nominal"),
permitted=list(
"factor"))
private$..covs <- jmvcore::OptionVariables$new(
"covs",
covs,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..facs <- jmvcore::OptionVariables$new(
"facs",
facs,
suggested=list(
"nominal",
"ordinal"),
permitted=list(
"factor"))
private$..trans <- jmvcore::OptionList$new(
"trans",
trans,
options=list(
"range",
"center",
"scale",
"knnImpute",
"bagImpute"),
default="bagImpute")
private$..method <- jmvcore::OptionList$new(
"method",
method,
options=list(
"pls",
"ctree",
"knn",
"rf",
"rpart",
"nnet",
"neuralnet",
"avNNet",
"gbm",
"glm",
"glmboost",
"glmnet",
"blackboost",
"lda",
"mda",
"treebag",
"C5.0",
"svmLinear",
"svmRadial",
"bagFDA",
"nb"),
default="pls")
private$..cm1 <- jmvcore::OptionList$new(
"cm1",
cm1,
options=list(
"pls",
"ctree",
"knn",
"rf",
"rpart",
"nnet",
"neuralnet",
"avNNet",
"gbm",
"glm",
"glmboost",
"glmnet",
"blackboost",
"lda",
"mda",
"treebag",
"C5.0",
"svmLinear",
"svmRadial",
"bagFDA",
"nb"),
default="ctree")
private$..mecon <- jmvcore::OptionList$new(
"mecon",
mecon,
options=list(
"cv",
"repeatedcv",
"boot",
"boot_all"),
default="cv")
private$..number <- jmvcore::OptionNumber$new(
"number",
number,
min=10,
default=10)
private$..repeats <- jmvcore::OptionNumber$new(
"repeats",
repeats,
min=5,
default=5)
private$..tune <- jmvcore::OptionNumber$new(
"tune",
tune,
min=3,
default=10)
private$..per <- jmvcore::OptionNumber$new(
"per",
per,
min=0.1,
max=1,
default=0.7)
private$..over1 <- jmvcore::OptionBool$new(
"over1",
over1,
default=TRUE)
private$..over <- jmvcore::OptionBool$new(
"over",
over,
default=FALSE)
private$..cla <- jmvcore::OptionBool$new(
"cla",
cla,
default=FALSE)
private$..cla1 <- jmvcore::OptionBool$new(
"cla1",
cla1,
default=FALSE)
private$..tra <- jmvcore::OptionBool$new(
"tra",
tra,
default=TRUE)
private$..tes <- jmvcore::OptionBool$new(
"tes",
tes,
default=FALSE)
private$..plot <- jmvcore::OptionBool$new(
"plot",
plot,
default=FALSE)
private$..plot1 <- jmvcore::OptionBool$new(
"plot1",
plot1,
default=FALSE)
private$..plot2 <- jmvcore::OptionBool$new(
"plot2",
plot2,
default=FALSE)
private$..plot3 <- jmvcore::OptionBool$new(
"plot3",
plot3,
default=FALSE)
private$..plot4 <- jmvcore::OptionBool$new(
"plot4",
plot4,
default=FALSE)
private$..pred <- jmvcore::OptionOutput$new(
"pred")
private$..plot5 <- jmvcore::OptionBool$new(
"plot5",
plot5,
default=FALSE)
private$..plot6 <- jmvcore::OptionBool$new(
"plot6",
plot6,
default=FALSE)
private$..plot7 <- jmvcore::OptionBool$new(
"plot7",
plot7,
default=FALSE)
private$..ml <- jmvcore::OptionString$new(
"ml",
ml,
default="pls,ctree,knn,rf")
private$..me <- jmvcore::OptionList$new(
"me",
me,
options=list(
"cv",
"repeatedcv",
"boot",
"boot_all"),
default="cv")
private$..num <- jmvcore::OptionNumber$new(
"num",
num,
min=10,
default=10)
private$..rep <- jmvcore::OptionNumber$new(
"rep",
rep,
min=5,
default=5)
private$..tune1 <- jmvcore::OptionNumber$new(
"tune1",
tune1,
min=3,
default=10)
private$..accu <- jmvcore::OptionBool$new(
"accu",
accu,
default=FALSE)
private$..kapp <- jmvcore::OptionBool$new(
"kapp",
kapp,
default=FALSE)
private$..width <- jmvcore::OptionInteger$new(
"width",
width,
default=500)
private$..height <- jmvcore::OptionInteger$new(
"height",
height,
default=500)
private$..width1 <- jmvcore::OptionInteger$new(
"width1",
width1,
default=500)
private$..height1 <- jmvcore::OptionInteger$new(
"height1",
height1,
default=500)
private$..width2 <- jmvcore::OptionInteger$new(
"width2",
width2,
default=500)
private$..height2 <- jmvcore::OptionInteger$new(
"height2",
height2,
default=500)
private$..width3 <- jmvcore::OptionInteger$new(
"width3",
width3,
default=500)
private$..height3 <- jmvcore::OptionInteger$new(
"height3",
height3,
default=500)
private$..width4 <- jmvcore::OptionInteger$new(
"width4",
width4,
default=500)
private$..height4 <- jmvcore::OptionInteger$new(
"height4",
height4,
default=500)
private$..width5 <- jmvcore::OptionInteger$new(
"width5",
width5,
default=500)
private$..height5 <- jmvcore::OptionInteger$new(
"height5",
height5,
default=500)
private$..width6 <- jmvcore::OptionInteger$new(
"width6",
width6,
default=500)
private$..height6 <- jmvcore::OptionInteger$new(
"height6",
height6,
default=500)
private$..width7 <- jmvcore::OptionInteger$new(
"width7",
width7,
default=500)
private$..height7 <- jmvcore::OptionInteger$new(
"height7",
height7,
default=500)
private$..plot8 <- jmvcore::OptionBool$new(
"plot8",
plot8,
default=FALSE)
private$..width8 <- jmvcore::OptionInteger$new(
"width8",
width8,
default=500)
private$..height8 <- jmvcore::OptionInteger$new(
"height8",
height8,
default=500)
self$.addOption(private$..dep)
self$.addOption(private$..covs)
self$.addOption(private$..facs)
self$.addOption(private$..trans)
self$.addOption(private$..method)
self$.addOption(private$..cm1)
self$.addOption(private$..mecon)
self$.addOption(private$..number)
self$.addOption(private$..repeats)
self$.addOption(private$..tune)
self$.addOption(private$..per)
self$.addOption(private$..over1)
self$.addOption(private$..over)
self$.addOption(private$..cla)
self$.addOption(private$..cla1)
self$.addOption(private$..tra)
self$.addOption(private$..tes)
self$.addOption(private$..plot)
self$.addOption(private$..plot1)
self$.addOption(private$..plot2)
self$.addOption(private$..plot3)
self$.addOption(private$..plot4)
self$.addOption(private$..pred)
self$.addOption(private$..plot5)
self$.addOption(private$..plot6)
self$.addOption(private$..plot7)
self$.addOption(private$..ml)
self$.addOption(private$..me)
self$.addOption(private$..num)
self$.addOption(private$..rep)
self$.addOption(private$..tune1)
self$.addOption(private$..accu)
self$.addOption(private$..kapp)
self$.addOption(private$..width)
self$.addOption(private$..height)
self$.addOption(private$..width1)
self$.addOption(private$..height1)
self$.addOption(private$..width2)
self$.addOption(private$..height2)
self$.addOption(private$..width3)
self$.addOption(private$..height3)
self$.addOption(private$..width4)
self$.addOption(private$..height4)
self$.addOption(private$..width5)
self$.addOption(private$..height5)
self$.addOption(private$..width6)
self$.addOption(private$..height6)
self$.addOption(private$..width7)
self$.addOption(private$..height7)
self$.addOption(private$..plot8)
self$.addOption(private$..width8)
self$.addOption(private$..height8)
}),
active = list(
dep = function() private$..dep$value,
covs = function() private$..covs$value,
facs = function() private$..facs$value,
trans = function() private$..trans$value,
method = function() private$..method$value,
cm1 = function() private$..cm1$value,
mecon = function() private$..mecon$value,
number = function() private$..number$value,
repeats = function() private$..repeats$value,
tune = function() private$..tune$value,
per = function() private$..per$value,
over1 = function() private$..over1$value,
over = function() private$..over$value,
cla = function() private$..cla$value,
cla1 = function() private$..cla1$value,
tra = function() private$..tra$value,
tes = function() private$..tes$value,
plot = function() private$..plot$value,
plot1 = function() private$..plot1$value,
plot2 = function() private$..plot2$value,
plot3 = function() private$..plot3$value,
plot4 = function() private$..plot4$value,
pred = function() private$..pred$value,
plot5 = function() private$..plot5$value,
plot6 = function() private$..plot6$value,
plot7 = function() private$..plot7$value,
ml = function() private$..ml$value,
me = function() private$..me$value,
num = function() private$..num$value,
rep = function() private$..rep$value,
tune1 = function() private$..tune1$value,
accu = function() private$..accu$value,
kapp = function() private$..kapp$value,
width = function() private$..width$value,
height = function() private$..height$value,
width1 = function() private$..width1$value,
height1 = function() private$..height1$value,
width2 = function() private$..width2$value,
height2 = function() private$..height2$value,
width3 = function() private$..width3$value,
height3 = function() private$..height3$value,
width4 = function() private$..width4$value,
height4 = function() private$..height4$value,
width5 = function() private$..width5$value,
height5 = function() private$..height5$value,
width6 = function() private$..width6$value,
height6 = function() private$..height6$value,
width7 = function() private$..width7$value,
height7 = function() private$..height7$value,
plot8 = function() private$..plot8$value,
width8 = function() private$..width8$value,
height8 = function() private$..height8$value),
private = list(
..dep = NA,
..covs = NA,
..facs = NA,
..trans = NA,
..method = NA,
..cm1 = NA,
..mecon = NA,
..number = NA,
..repeats = NA,
..tune = NA,
..per = NA,
..over1 = NA,
..over = NA,
..cla = NA,
..cla1 = NA,
..tra = NA,
..tes = NA,
..plot = NA,
..plot1 = NA,
..plot2 = NA,
..plot3 = NA,
..plot4 = NA,
..pred = NA,
..plot5 = NA,
..plot6 = NA,
..plot7 = NA,
..ml = NA,
..me = NA,
..num = NA,
..rep = NA,
..tune1 = NA,
..accu = NA,
..kapp = NA,
..width = NA,
..height = NA,
..width1 = NA,
..height1 = NA,
..width2 = NA,
..height2 = NA,
..width3 = NA,
..height3 = NA,
..width4 = NA,
..height4 = NA,
..width5 = NA,
..height5 = NA,
..width6 = NA,
..height6 = NA,
..width7 = NA,
..height7 = NA,
..plot8 = NA,
..width8 = NA,
..height8 = NA)
)
caretResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"caretResults",
inherit = jmvcore::Group,
active = list(
instructions = function() private$.items[["instructions"]],
text1 = function() private$.items[["text1"]],
text = function() private$.items[["text"]],
over1 = function() private$.items[["over1"]],
over = function() private$.items[["over"]],
tra = function() private$.items[["tra"]],
tes = function() private$.items[["tes"]],
cla1 = function() private$.items[["cla1"]],
cla = function() private$.items[["cla"]],
plot2 = function() private$.items[["plot2"]],
plot8 = function() private$.items[["plot8"]],
plot = function() private$.items[["plot"]],
plot4 = function() private$.items[["plot4"]],
plot1 = function() private$.items[["plot1"]],
plot3 = function() private$.items[["plot3"]],
plot5 = function() private$.items[["plot5"]],
plot6 = function() private$.items[["plot6"]],
mf = function() private$.items[["mf"]],
plot7 = function() private$.items[["plot7"]],
pred = function() private$.items[["pred"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Machine Learning",
refs="snowCluster")
self$add(jmvcore::Html$new(
options=options,
name="instructions",
title="Instructions",
visible=TRUE))
self$add(jmvcore::Preformatted$new(
options=options,
name="text1",
title="Pre-processing"))
self$add(jmvcore::Preformatted$new(
options=options,
name="text",
title="Model information"))
self$add(jmvcore::Table$new(
options=options,
name="over1",
title="Overall statistics with training set",
rows=1,
visible="(over1)",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"method",
"mecon",
"number",
"repeats",
"tune",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
columns=list(
list(
`name`="accu",
`title`="Accuracy",
`type`="number"),
list(
`name`="lower",
`title`="Lower",
`type`="number",
`superTitle`="Accuracy 95% CI"),
list(
`name`="upper",
`title`="Upper",
`type`="number",
`superTitle`="Accuracy 95% CI"),
list(
`name`="kappa",
`title`="Kappa",
`type`="number"))))
self$add(jmvcore::Table$new(
options=options,
name="over",
title="Overall statistics with test set",
rows=1,
visible="(over)",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
columns=list(
list(
`name`="accu",
`title`="Accuracy",
`type`="number"),
list(
`name`="lower",
`title`="Lower",
`type`="number",
`superTitle`="Accuracy 95% CI"),
list(
`name`="upper",
`title`="Upper",
`type`="number",
`superTitle`="Accuracy 95% CI"),
list(
`name`="kappa",
`title`="Kappa",
`type`="number"))))
self$add(jmvcore::Table$new(
options=options,
name="tra",
title="Confusion matrix with training set",
visible="(tra)",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"))))
self$add(jmvcore::Table$new(
options=options,
name="tes",
title="Confusion matrix with test set",
visible="(tes)",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
refs="caret",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"))))
self$add(jmvcore::Table$new(
options=options,
name="cla1",
title="Statistics by class with training set",
visible="(cla1)",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"))))
self$add(jmvcore::Table$new(
options=options,
name="cla",
title="Statistics by class with test set",
visible="(cla)",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"))))
self$add(jmvcore::Image$new(
options=options,
name="plot2",
title="Model selection plot",
visible="(plot2)",
renderFun=".plot2",
refs="caret",
requiresData=TRUE,
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width2",
"height2")))
self$add(jmvcore::Image$new(
options=options,
name="plot8",
title="ROC plot with training set",
visible="(plot8)",
renderFun=".plot8",
refs="MLeval",
requiresData=TRUE,
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"facs",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width8",
"height8")))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Comparison of ROC curves",
visible="(plot)",
renderFun=".plot",
refs="MLeval",
requiresData=TRUE,
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"cm1",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width",
"height")))
self$add(jmvcore::Image$new(
options=options,
name="plot4",
title="Calibration curve with training set",
visible="(plot4)",
renderFun=".plot4",
refs="MLeval",
requiresData=TRUE,
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"cm1",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width4",
"height4")))
self$add(jmvcore::Image$new(
options=options,
name="plot1",
title="Variable importance plot",
visible="(plot1)",
renderFun=".plot1",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"facs",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width1",
"height1")))
self$add(jmvcore::Image$new(
options=options,
name="plot3",
title="ROC plot with test set",
visible="(plot3)",
renderFun=".plot3",
refs="MLeval",
clearWith=list(
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"facs",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width3",
"height3")))
self$add(jmvcore::Image$new(
options=options,
name="plot5",
title="Box plot",
visible="(plot5)",
renderFun=".plot5",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"cm1",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width5",
"height5")))
self$add(jmvcore::Image$new(
options=options,
name="plot6",
title="Density plot",
visible="(plot6)",
renderFun=".plot6",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"number",
"repeats",
"method",
"tune",
"cm1",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width6",
"height6")))
self$add(R6::R6Class(
inherit = jmvcore::Group,
active = list(
accu = function() private$.items[["accu"]],
kapp = function() private$.items[["kapp"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="mf",
title="Model Comparison")
self$add(jmvcore::Table$new(
options=options,
name="accu",
title="Accuracy for model comparison",
visible="(accu)",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"method",
"cm1",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
columns=list(
list(
`name`="name",
`title`="Model",
`type`="text",
`content`="($key)"),
list(
`name`="min",
`title`="Minimum",
`type`="number"),
list(
`name`="q1",
`title`="Q1",
`type`="number"),
list(
`name`="med",
`title`="Median",
`type`="number"),
list(
`name`="me",
`title`="Mean",
`type`="number"),
list(
`name`="q3",
`title`="Q3",
`type`="number"),
list(
`name`="max",
`title`="Maximum",
`type`="number"),
list(
`name`="na",
`title`="NA",
`type`="number"))))
self$add(jmvcore::Table$new(
options=options,
name="kapp",
title="Kappa for model comparison",
visible="(kapp)",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"method",
"cm1",
"ml",
"me",
"num",
"rep",
"tune1",
"trans"),
columns=list(
list(
`name`="name",
`title`="Model",
`type`="text",
`content`="($key)"),
list(
`name`="min",
`title`="Minimum",
`type`="number"),
list(
`name`="q1",
`title`="Q1",
`type`="number"),
list(
`name`="med",
`title`="Median",
`type`="number"),
list(
`name`="me",
`title`="Mean",
`type`="number"),
list(
`name`="q3",
`title`="Q3",
`type`="number"),
list(
`name`="max",
`title`="Maximum",
`type`="number"),
list(
`name`="na",
`title`="NA",
`type`="number"))))}))$new(options=options))
self$add(jmvcore::Image$new(
options=options,
name="plot7",
title="Box plots to compare models",
visible="(plot7)",
renderFun=".plot7",
refs="caret",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"method",
"cm1",
"ml",
"me",
"num",
"rep",
"tune1",
"trans",
"width7",
"height7")))
self$add(jmvcore::Output$new(
options=options,
name="pred",
title="Prediction",
varTitle="Prediction",
measureType="nominal",
clearWith=list(
"facs",
"covs",
"dep",
"per",
"mecon",
"method",
"number",
"repeats",
"tune",
"cm1",
"ml",
"me",
"trans")))}))
caretBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"caretBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "snowCluster",
name = "caret",
version = c(1,0,0),
options = options,
results = caretResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'none')
}))
#' Machine Learning
#'
#'
#' @param data .
#' @param dep .
#' @param covs .
#' @param facs .
#' @param trans .
#' @param method .
#' @param cm1 .
#' @param mecon .
#' @param number .
#' @param repeats .
#' @param tune .
#' @param per .
#' @param over1 .
#' @param over .
#' @param cla .
#' @param cla1 .
#' @param tra .
#' @param tes .
#' @param plot .
#' @param plot1 .
#' @param plot2 .
#' @param plot3 .
#' @param plot4 .
#' @param plot5 .
#' @param plot6 .
#' @param plot7 .
#' @param ml .
#' @param me .
#' @param num .
#' @param rep .
#' @param tune1 .
#' @param accu .
#' @param kapp .
#' @param width .
#' @param height .
#' @param width1 .
#' @param height1 .
#' @param width2 .
#' @param height2 .
#' @param width3 .
#' @param height3 .
#' @param width4 .
#' @param height4 .
#' @param width5 .
#' @param height5 .
#' @param width6 .
#' @param height6 .
#' @param width7 .
#' @param height7 .
#' @param plot8 .
#' @param width8 .
#' @param height8 .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$instructions} \tab \tab \tab \tab \tab a html \cr
#' \code{results$text1} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$text} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$over1} \tab \tab \tab \tab \tab a table \cr
#' \code{results$over} \tab \tab \tab \tab \tab a table \cr
#' \code{results$tra} \tab \tab \tab \tab \tab a table \cr
#' \code{results$tes} \tab \tab \tab \tab \tab a table \cr
#' \code{results$cla1} \tab \tab \tab \tab \tab a table \cr
#' \code{results$cla} \tab \tab \tab \tab \tab a table \cr
#' \code{results$plot2} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot8} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot4} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot1} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot3} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot5} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot6} \tab \tab \tab \tab \tab an image \cr
#' \code{results$mf$accu} \tab \tab \tab \tab \tab a table \cr
#' \code{results$mf$kapp} \tab \tab \tab \tab \tab a table \cr
#' \code{results$plot7} \tab \tab \tab \tab \tab an image \cr
#' \code{results$pred} \tab \tab \tab \tab \tab an output \cr
#' }
#'
#' Tables can be converted to data frames with \code{asDF} or \code{\link{as.data.frame}}. For example:
#'
#' \code{results$over1$asDF}
#'
#' \code{as.data.frame(results$over1)}
#'
#' @export
caret <- function(
data,
dep,
covs,
facs,
trans = "bagImpute",
method = "pls",
cm1 = "ctree",
mecon = "cv",
number = 10,
repeats = 5,
tune = 10,
per = 0.7,
over1 = TRUE,
over = FALSE,
cla = FALSE,
cla1 = FALSE,
tra = TRUE,
tes = FALSE,
plot = FALSE,
plot1 = FALSE,
plot2 = FALSE,
plot3 = FALSE,
plot4 = FALSE,
plot5 = FALSE,
plot6 = FALSE,
plot7 = FALSE,
ml = "pls,ctree,knn,rf",
me = "cv",
num = 10,
rep = 5,
tune1 = 10,
accu = FALSE,
kapp = FALSE,
width = 500,
height = 500,
width1 = 500,
height1 = 500,
width2 = 500,
height2 = 500,
width3 = 500,
height3 = 500,
width4 = 500,
height4 = 500,
width5 = 500,
height5 = 500,
width6 = 500,
height6 = 500,
width7 = 500,
height7 = 500,
plot8 = FALSE,
width8 = 500,
height8 = 500) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("caret requires jmvcore to be installed (restart may be required)")
if ( ! missing(dep)) dep <- jmvcore::resolveQuo(jmvcore::enquo(dep))
if ( ! missing(covs)) covs <- jmvcore::resolveQuo(jmvcore::enquo(covs))
if ( ! missing(facs)) facs <- jmvcore::resolveQuo(jmvcore::enquo(facs))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(dep), dep, NULL),
`if`( ! missing(covs), covs, NULL),
`if`( ! missing(facs), facs, NULL))
for (v in dep) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in facs) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
options <- caretOptions$new(
dep = dep,
covs = covs,
facs = facs,
trans = trans,
method = method,
cm1 = cm1,
mecon = mecon,
number = number,
repeats = repeats,
tune = tune,
per = per,
over1 = over1,
over = over,
cla = cla,
cla1 = cla1,
tra = tra,
tes = tes,
plot = plot,
plot1 = plot1,
plot2 = plot2,
plot3 = plot3,
plot4 = plot4,
plot5 = plot5,
plot6 = plot6,
plot7 = plot7,
ml = ml,
me = me,
num = num,
rep = rep,
tune1 = tune1,
accu = accu,
kapp = kapp,
width = width,
height = height,
width1 = width1,
height1 = height1,
width2 = width2,
height2 = height2,
width3 = width3,
height3 = height3,
width4 = width4,
height4 = height4,
width5 = width5,
height5 = height5,
width6 = width6,
height6 = height6,
width7 = width7,
height7 = height7,
plot8 = plot8,
width8 = width8,
height8 = height8)
analysis <- caretClass$new(
options = options,
data = data)
analysis$run()
analysis$results
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.