# This file is automatically generated, you probably don't want to edit this
repeatedOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"repeatedOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
variables = NULL, ...) {
super$initialize(
package='Statkat',
name='repeated',
requiresData=TRUE,
...)
private$..variables <- jmvcore::OptionVariables$new(
"variables",
variables)
self$.addOption(private$..variables)
}),
active = list(
variables = function() private$..variables$value),
private = list(
..variables = NA)
)
repeatedResults <- if (requireNamespace('jmvcore')) R6::R6Class(
inherit = jmvcore::Group,
active = list(
advice = function() private$.items[["advice"]],
plot = function() private$.items[["plot"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Repeated Measurements")
self$add(jmvcore::Html$new(
options=options,
name="advice",
title="Advice",
visible="(text)"))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Scatter Plot",
width=400,
height=300,
requiresData=TRUE,
renderFun=".plot"))}))
repeatedBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"repeatedBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = 'Statkat',
name = 'repeated',
version = c(1,0,0),
options = options,
results = repeatedResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = TRUE)
}))
#' Repeated Measurements
#'
#' Provides a recommended statistical method given the measurement level of
#' your data. Appropriate for repeated measurements.
#'
#' @examples
#' exampleData <- data.frame(x1 = rnorm(20),
#' x2 = rnorm(20),
#' x3 = rnorm(20),
#' x4 = as.factor(c(rep(1, 10), rep(2, 10))),
#' x5 = as.factor(c(rep(1, 5), rep(2, 5), rep(3, 10))),
#' x6 = as.ordered(c(rep(1, 5), rep(2, 5), rep(3, 10))),
#' x7 = as.ordered(c(rep(1, 10), rep(2, 5), rep(3, 5))))
#'
#' repeated(exampleData, variables = c('x1', 'x2', 'x3'))
#' repeated(exampleData, variables = c('x4', 'x5'))
#' repeated(exampleData, variables = c('x6', 'x7'))
#'
#' @param data the data as a data frame, with variables encoded as numeric
#' (for interval/ratio variables), ordered (for ordinal variables), or factor
#' (for nominal variables)
#' @param variables a vector of strings naming the related variables from
#' \code{data}
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$advice} \tab \tab \tab \tab \tab the method recommendation \cr
#' \code{results$plot} \tab \tab \tab \tab \tab a scatter plot of the data \cr
#' }
#'
#' @export
repeated <- function(
data,
variables) {
if ( ! requireNamespace('jmvcore'))
stop('repeated requires jmvcore to be installed (restart may be required)')
options <- repeatedOptions$new(
variables = variables)
results <- repeatedResults$new(
options = options)
analysis <- repeatedClass$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.