-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
924 additions
and
2,781 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#' @importFrom R6 R6Class | ||
#' @import jmvcore | ||
#' | ||
# This file is a generated template, your changes will not be overwritten | ||
|
||
clusterClass <- if (requireNamespace('jmvcore')) R6::R6Class( | ||
"clusterClass", | ||
inherit = clusterBase, | ||
private = list( | ||
.run = function() { | ||
|
||
# `self$data` contains the data | ||
# `self$options` contains the options | ||
# `self$results` contains the results object (to populate) | ||
|
||
}) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
|
||
# This file is automatically generated, you probably don't want to edit this | ||
|
||
clusterOptions <- if (requireNamespace('jmvcore')) R6::R6Class( | ||
"clusterOptions", | ||
inherit = jmvcore::Options, | ||
public = list( | ||
initialize = function( | ||
dep = NULL, | ||
group = NULL, | ||
alt = "notequal", | ||
varEq = TRUE, ...) { | ||
|
||
super$initialize( | ||
package='ClinicoPath', | ||
name='cluster', | ||
requiresData=TRUE, | ||
...) | ||
|
||
private$..dep <- jmvcore::OptionVariable$new( | ||
"dep", | ||
dep) | ||
private$..group <- jmvcore::OptionVariable$new( | ||
"group", | ||
group) | ||
private$..alt <- jmvcore::OptionList$new( | ||
"alt", | ||
alt, | ||
options=list( | ||
"notequal", | ||
"onegreater", | ||
"twogreater"), | ||
default="notequal") | ||
private$..varEq <- jmvcore::OptionBool$new( | ||
"varEq", | ||
varEq, | ||
default=TRUE) | ||
|
||
self$.addOption(private$..dep) | ||
self$.addOption(private$..group) | ||
self$.addOption(private$..alt) | ||
self$.addOption(private$..varEq) | ||
}), | ||
active = list( | ||
dep = function() private$..dep$value, | ||
group = function() private$..group$value, | ||
alt = function() private$..alt$value, | ||
varEq = function() private$..varEq$value), | ||
private = list( | ||
..dep = NA, | ||
..group = NA, | ||
..alt = NA, | ||
..varEq = NA) | ||
) | ||
|
||
clusterResults <- if (requireNamespace('jmvcore')) R6::R6Class( | ||
inherit = jmvcore::Group, | ||
active = list( | ||
text = function() private$.items[["text"]]), | ||
private = list(), | ||
public=list( | ||
initialize=function(options) { | ||
super$initialize( | ||
options=options, | ||
name="", | ||
title="Cluster Analysis") | ||
self$add(jmvcore::Preformatted$new( | ||
options=options, | ||
name="text", | ||
title="Cluster Analysis"))})) | ||
|
||
clusterBase <- if (requireNamespace('jmvcore')) R6::R6Class( | ||
"clusterBase", | ||
inherit = jmvcore::Analysis, | ||
public = list( | ||
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) { | ||
super$initialize( | ||
package = 'ClinicoPath', | ||
name = 'cluster', | ||
version = c(1,0,0), | ||
options = options, | ||
results = clusterResults$new(options=options), | ||
data = data, | ||
datasetId = datasetId, | ||
analysisId = analysisId, | ||
revision = revision, | ||
pause = NULL, | ||
completeWhenFilled = FALSE) | ||
})) | ||
|
||
#' Cluster Analysis | ||
#' | ||
#' | ||
#' @param data . | ||
#' @param dep . | ||
#' @param group . | ||
#' @param alt . | ||
#' @param varEq . | ||
#' @return A results object containing: | ||
#' \tabular{llllll}{ | ||
#' \code{results$text} \tab \tab \tab \tab \tab a preformatted \cr | ||
#' } | ||
#' | ||
#' @export | ||
cluster <- function( | ||
data, | ||
dep, | ||
group, | ||
alt = "notequal", | ||
varEq = TRUE) { | ||
|
||
if ( ! requireNamespace('jmvcore')) | ||
stop('cluster requires jmvcore to be installed (restart may be required)') | ||
|
||
if ( ! missing(dep)) dep <- jmvcore::resolveQuo(jmvcore::enquo(dep)) | ||
if ( ! missing(group)) group <- jmvcore::resolveQuo(jmvcore::enquo(group)) | ||
if (missing(data)) | ||
data <- jmvcore::marshalData( | ||
parent.frame(), | ||
`if`( ! missing(dep), dep, NULL), | ||
`if`( ! missing(group), group, NULL)) | ||
|
||
|
||
options <- clusterOptions$new( | ||
dep = dep, | ||
group = group, | ||
alt = alt, | ||
varEq = varEq) | ||
|
||
analysis <- clusterClass$new( | ||
options = options, | ||
data = data) | ||
|
||
analysis$run() | ||
|
||
analysis$results | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
# This file is a generated template, your changes will not be overwritten | ||
|
||
treeClass <- if (requireNamespace('jmvcore')) R6::R6Class( | ||
"treeClass", | ||
inherit = treeBase, | ||
private = list( | ||
.run = function() { | ||
|
||
# `self$data` contains the data | ||
# `self$options` contains the options | ||
# `self$results` contains the results object (to populate) | ||
|
||
}) | ||
) |
Oops, something went wrong.