runAnalysis: Run a JASP analysis in R.

View source: R/run.R

runAnalysisR Documentation

Run a JASP analysis in R.

Description

runAnalysis makes it possible to execute a JASP analysis in R. Usually this process is a bit cumbersome as there are a number of objects unique to the JASP environment. Think .ppi, data-reading, etc. These (rcpp) objects are replaced in the jaspTools so you do not have to deal with them. Note that runAnalysis sources JASP analyses every time it runs, so any change in analysis code between calls is incorporated. The output of the analysis is shown automatically through a call to view and returned invisibly.

Usage

runAnalysis(
  name,
  dataset,
  options,
  view = TRUE,
  quiet = FALSE,
  makeTests = FALSE
)

Arguments

name

String indicating the name of the analysis to run. This name is identical to that of the main function in a JASP analysis.

dataset

Data.frame, matrix, string name or string path; if it's a string then jaspTools first checks if it's valid path and if it isn't if the string matches one of the JASP datasets (e.g., "debug.csv"). By default the directory in Resources is checked first, unless called within a testthat environment, in which case tests/datasets is checked first.

options

List of options to supply to the analysis (see also analysisOptions).

view

Boolean indicating whether to view the results in a webbrowser.

quiet

Boolean indicating whether to suppress messages from the analysis.

makeTests

Boolean indicating whether to create testthat unit tests and print them to the terminal.

Examples


options <- analysisOptions("BinomialTest")
options[["variables"]] <- "contBinom"
runAnalysis("BinomialTest", "debug", options)

# Above and below are identical (below is taken from the Qt terminal)

options <- analysisOptions('{
   "id" : 6,
   "name" : "BinomialTest",
   "options" : {
      "VovkSellkeMPR" : false,
      "confidenceInterval" : false,
      "confidenceIntervalInterval" : 0.950,
      "descriptivesPlots" : false,
      "descriptivesPlotsConfidenceInterval" : 0.950,
      "hypothesis" : "notEqualToTestValue",
      "plotHeight" : 300,
      "plotWidth" : 160,
      "testValue" : 0.50,
      "variables" : [ "contBinom" ]
   },
   "perform" : "run",
   "revision" : 1,
   "settings" : {
      "ppi" : 192
   }
}')
runAnalysis("BinomialTest", "debug.csv", options)



jasp-stats/JASPTools documentation built on April 24, 2024, 11:18 a.m.