|
| 1 | +addOne <- function(jaspResults, dataset, options) { |
| 2 | + result <- as.character(options$my_number + 1) # options$my_number comes from the menu created by inst/qml/integer.qml |
| 3 | + |
| 4 | + jaspResults[["result"]] <- createJaspHtml(text = result, |
| 5 | + title = "This is your result:") |
| 6 | + |
| 7 | + return() |
| 8 | +} |
| 9 | + |
| 10 | +processData <- function(jaspResults, dataset, options) { |
| 11 | + # Dataset access |
| 12 | + # options$ts --maps to--> 't' |
| 13 | + # dataset[[options$ts]] --maps to--> dataset$t |
| 14 | + result <- paste(dataset[[options$ts]], collapse = "") |
| 15 | + jaspResults[["result"]] <- createJaspHtml(text = result, |
| 16 | + title = "This is your result:") |
| 17 | + |
| 18 | + return() |
| 19 | +} |
| 20 | + |
| 21 | +processTable <- function(jaspResults, dataset, options) { |
| 22 | + # Prints the inputs as a table |
| 23 | + stats <- createJaspTable(gettext("Some descriptives")) |
| 24 | + |
| 25 | + stats$addColumnInfo(name = gettext("times")) |
| 26 | + stats$addColumnInfo(name = gettext("xs")) |
| 27 | + |
| 28 | + stats[["times"]] <- dataset[[options$ts]] |
| 29 | + stats[["xs"]] <- dataset[[options$xs]] |
| 30 | + |
| 31 | + jaspResults[["stats"]] <- stats |
| 32 | + |
| 33 | + return() |
| 34 | +} |
| 35 | + |
| 36 | +parabola <- function(jaspResults, dataset, options) { |
| 37 | + # Analysis |
| 38 | + f <- function(x) { options$a * x^2 } # Function to be plotted |
| 39 | + p <- ggplot2::ggplot() + # Plotting command |
| 40 | + ggplot2::xlim(-3, 3) + |
| 41 | + ggplot2::ylim(0, 10) + |
| 42 | + ggplot2::geom_function(fun = f) |
| 43 | +# add jasp theme |
| 44 | +p <- jaspGraphs::geom_rangeframe() + |
| 45 | + jaspGraphs::themeJaspRaw() |
| 46 | + # Aesthetics |
| 47 | + parabolaPlot <- createJaspPlot(title = gettext("Parabola"), |
| 48 | + width = 160, |
| 49 | + height = 320) |
| 50 | + parabolaPlot$dependOn(c("a")) # Refresh view whenever a changes |
| 51 | +parabolaPlot$info <- gettext("This figure displays a parabola specified via the `a` option.") |
| 52 | + jaspResults[["parabolaPlot"]] <- parabolaPlot |
| 53 | + parabolaPlot$plotObject <- p |
| 54 | + |
| 55 | + return() |
| 56 | +} |
0 commit comments