# This file is automatically generated, you probably don't want to edit this
linechartOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"linechartOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
xvar = NULL,
yvar = NULL, ...) {
super$initialize(
package="ClinicoPath",
name="linechart",
requiresData=TRUE,
...)
private$..xvar <- jmvcore::OptionVariable$new(
"xvar",
xvar)
private$..yvar <- jmvcore::OptionVariable$new(
"yvar",
yvar)
self$.addOption(private$..xvar)
self$.addOption(private$..yvar)
}),
active = list(
xvar = function() private$..xvar$value,
yvar = function() private$..yvar$value),
private = list(
..xvar = NA,
..yvar = NA)
)
linechartResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"linechartResults",
inherit = jmvcore::Group,
active = list(
text = function() private$.items[["text"]],
plot = function() private$.items[["plot"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Line Chart",
refs=list(
"ClinicoPathJamoviModule"))
self$add(jmvcore::Preformatted$new(
options=options,
name="text",
title="Line Chart"))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="`${xvar} - {yvar}`",
width=600,
height=450,
renderFun=".plot",
requiresData=TRUE))}))
linechartBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"linechartBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "ClinicoPath",
name = "linechart",
version = c(1,0,0),
options = options,
results = linechartResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Line Chart
#'
#'
#' @param data .
#' @param xvar .
#' @param yvar .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$text} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' }
#'
#' @export
linechart <- function(
data,
xvar,
yvar) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("linechart requires jmvcore to be installed (restart may be required)")
if ( ! missing(xvar)) xvar <- jmvcore::resolveQuo(jmvcore::enquo(xvar))
if ( ! missing(yvar)) yvar <- jmvcore::resolveQuo(jmvcore::enquo(yvar))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(xvar), xvar, NULL),
`if`( ! missing(yvar), yvar, NULL))
options <- linechartOptions$new(
xvar = xvar,
yvar = yvar)
analysis <- linechartClass$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.