# This file is automatically generated, you probably don't want to edit this
decision2Options <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"decision2Options",
inherit = jmvcore::Options,
public = list(
initialize = function(
gold = NULL,
goldPositive = NULL,
newtest = NULL,
testPositive = NULL, ...) {
super$initialize(
package="ClinicoPath",
name="decision2",
requiresData=TRUE,
...)
private$..gold <- jmvcore::OptionVariable$new(
"gold",
gold,
suggested=list(
"nominal"),
permitted=list(
"factor"))
private$..goldPositive <- jmvcore::OptionLevel$new(
"goldPositive",
goldPositive,
variable="(gold)")
private$..newtest <- jmvcore::OptionVariable$new(
"newtest",
newtest,
suggested=list(
"nominal"),
permitted=list(
"factor"))
private$..testPositive <- jmvcore::OptionLevel$new(
"testPositive",
testPositive,
variable="(newtest)")
self$.addOption(private$..gold)
self$.addOption(private$..goldPositive)
self$.addOption(private$..newtest)
self$.addOption(private$..testPositive)
}),
active = list(
gold = function() private$..gold$value,
goldPositive = function() private$..goldPositive$value,
newtest = function() private$..newtest$value,
testPositive = function() private$..testPositive$value),
private = list(
..gold = NA,
..goldPositive = NA,
..newtest = NA,
..testPositive = NA)
)
decision2Results <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"decision2Results",
inherit = jmvcore::Group,
active = list(
cTable = function() private$.items[["cTable"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Decision 2 for using init",
refs=list(
"ClinicoPathJamoviModule"))
self$add(jmvcore::Table$new(
options=options,
name="cTable",
title="Recoded Data for Decision Test Statistics",
rows=0,
columns=list(
list(
`name`="newtest",
`title`="",
`type`="text"),
list(
`name`="GP",
`title`="Gold Positive",
`type`="number"),
list(
`name`="GN",
`title`="Gold Negative",
`type`="number"),
list(
`name`="Total",
`title`="Total",
`type`="number"))))}))
decision2Base <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"decision2Base",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPath",
name = "decision2",
version = c(1,0,0),
options = options,
results = decision2Results$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Decision 2 for using init
#'
#' Function for Medical Decision Analysis. Sensitivity, specificity, positive
#' predictive value, negative predictive value.
#'
#'
#' @examples
#' \donttest{
#' # example will be added
#'}
#' @param data The data as a data frame.
#' @param gold .
#' @param goldPositive .
#' @param newtest .
#' @param testPositive .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$cTable} \tab \tab \tab \tab \tab a table \cr
#' }
#'
#' Tables can be converted to data frames with \code{asDF} or \code{\link{as.data.frame}}. For example:
#'
#' \code{results$cTable$asDF}
#'
#' \code{as.data.frame(results$cTable)}
#'
#' @export
decision2 <- function(
data,
gold,
goldPositive,
newtest,
testPositive) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("decision2 requires jmvcore to be installed (restart may be required)")
if ( ! missing(gold)) gold <- jmvcore::resolveQuo(jmvcore::enquo(gold))
if ( ! missing(newtest)) newtest <- jmvcore::resolveQuo(jmvcore::enquo(newtest))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(gold), gold, NULL),
`if`( ! missing(newtest), newtest, NULL))
for (v in gold) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in newtest) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
options <- decision2Options$new(
gold = gold,
goldPositive = goldPositive,
newtest = newtest,
testPositive = testPositive)
analysis <- decision2Class$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.