Development Cheat Sheet

A quick reference for the essential components and commands used in jamovi module development.

📂 Project Structure

  • jamovi/0000.yaml: Module metadata (name, version).
  • jamovi/analysis.a.yaml: UI and input options definition.
  • jamovi/analysis.r.yaml: Results and table structure.
  • jamovi/analysis.u.yaml: UI layout and grouping.
  • R/analysis.b.R: R implementation (R6 class).

🛠️ Essential Commands

Run these from within your module directory in R:

  • jmvtools::install(): Compiles and installs the module into jamovi.
  • jmvtools::check(): Validates the module structure.
  • jmvtools::prepare(): Regenerates R source files from YAML.
  • devtools::test(): Runs the automated test suite.

📊 Data Types

Used in .a.yaml for VariableSuppliers:

  • Continuous: Scale/Interval data.
  • Nominal: Categorical data.
  • Ordinal: Ordered categorical data.
  • ID: Identifiers (not usually analysed).

🎛️ UI Controls

Common types used in .u.yaml:

  • VariableSupplier: The source list of variables.
  • TargetLayoutBox: Drop target for variables.
  • CheckBox: Boolean toggle.
  • ComboBox: Dropdown selection.
  • RadioButton: Mutually exclusive options.
  • TextBox: Text or numeric input.

📝 R Implementation

Common patterns in .b.R:

  • self$options$name: Access user inputs.
  • self$data: Access the data frame.
  • self$results$name: Access a results element.
  • table$setRow(rowKey=k, values=list(...)): Populate a table row.
  • table$setStatus('complete'): Signal completion.

Results Elements

Common types used in .r.yaml:

  • Table: APA-formatted statistical tables.
  • Image: Plots and graphical output (ggplot2).
  • Preformatted: Raw text or R console output.
  • Array: Dynamic list of tables or images.
  • Html: Custom rich text or web-based content.

💡 Pro Tips

  • Guard Clauses: Use if (is.null(self$options$dep)) return() at the start of your .run() function to prevent errors when inputs are missing.
  • Dev Mode: Enable Development Mode in jamovi settings to see advanced stack traces and debug output.
  • Versioning: Increment your version in 0000.yaml before sharing your .jmo file to ensure users see the update.