R/example02.h.R

Defines functions Example02

Documented in Example02

# This file is automatically generated, you probably don't want to edit this

Example02Options <- if (requireNamespace('jmvcore')) R6::R6Class(
    "Example02Options",
    inherit = jmvcore::Options,
    public = list(
        initialize = function(
            dependent = NULL,
            group = NULL,
            equVar = TRUE, ...) {

            super$initialize(
                package='jamoviTemplate',
                name='Example02',
                requiresData=TRUE,
                ...)

            private$..dependent <- jmvcore::OptionVariable$new(
                "dependent",
                dependent)
            private$..group <- jmvcore::OptionVariable$new(
                "group",
                group)
            private$..equVar <- jmvcore::OptionBool$new(
                "equVar",
                equVar,
                default=TRUE)

            self$.addOption(private$..dependent)
            self$.addOption(private$..group)
            self$.addOption(private$..equVar)
        }),
    active = list(
        dependent = function() private$..dependent$value,
        group = function() private$..group$value,
        equVar = function() private$..equVar$value),
    private = list(
        ..dependent = NA,
        ..group = NA,
        ..equVar = NA)
)

Example02Results <- if (requireNamespace('jmvcore')) R6::R6Class(
    inherit = jmvcore::Group,
    active = list(),
    private = list(),
    public=list(
        initialize=function(options) {
            super$initialize(
                options=options,
                name="",
                title="Example 2")}))

Example02Base <- if (requireNamespace('jmvcore')) R6::R6Class(
    "Example02Base",
    inherit = jmvcore::Analysis,
    public = list(
        initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
            super$initialize(
                package = 'jamoviTemplate',
                name = 'Example02',
                version = c(1,0,0),
                options = options,
                results = Example02Results$new(options=options),
                data = data,
                datasetId = datasetId,
                analysisId = analysisId,
                revision = revision,
                pause = NULL,
                completeWhenFilled = FALSE,
                requiresMissings = FALSE)
        }))

#' Example 2
#'
#' 
#' @param data .
#' @param dependent .
#' @param group .
#' @param equVar .
#' @return A results object containing:
#' \tabular{llllll}{
#' }
#'
#' @export
Example02 <- function(
    data,
    dependent,
    group,
    equVar = TRUE) {

    if ( ! requireNamespace('jmvcore'))
        stop('Example02 requires jmvcore to be installed (restart may be required)')

    if ( ! missing(dependent)) dependent <- jmvcore::resolveQuo(jmvcore::enquo(dependent))
    if ( ! missing(group)) group <- jmvcore::resolveQuo(jmvcore::enquo(group))
    if (missing(data))
        data <- jmvcore::marshalData(
            parent.frame(),
            `if`( ! missing(dependent), dependent, NULL),
            `if`( ! missing(group), group, NULL))


    options <- Example02Options$new(
        dependent = dependent,
        group = group,
        equVar = equVar)

    analysis <- Example02Class$new(
        options = options,
        data = data)

    analysis$run()

    analysis$results
}
sbalci/jamoviTemplate documentation built on Jan. 9, 2021, 10:50 a.m.