mellio_payload: Build a Mellio Result Card payload from an R object

View source: R/bridge-payload.R

mellio_payloadR Documentation

Build a Mellio Result Card payload from an R object

Description

Converts a supported R model or test object into a structured JSON payload (a "Result Card") that Mellio renders in the Stats section. Pure and offline — no network calls. Use mellio_open() to additionally open the payload in the Mellio web app.

Usage

## S3 method for class 'aov'
mellio_payload(x, focal = NULL, controls = NULL, ..., .call = NULL)

## S3 method for class 'summary.aov'
mellio_payload(
  x,
  focal = NULL,
  controls = NULL,
  ...,
  .call = NULL,
  .env = parent.frame()
)

## S3 method for class 'aovlist'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'afex_aov'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'anova'
mellio_payload(x, focal = NULL, controls = NULL, ..., .call = NULL)

## S3 method for class 'brmsfit'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'stanreg'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'glm'
mellio_payload(
  x,
  ...,
  .call = NULL,
  focal = NULL,
  controls = NULL,
  exponentiate = FALSE,
  conf.int = TRUE,
  conf.level = 0.95
)

## S3 method for class 'rlm'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'gam'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'lme'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'glmmTMB'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'kmeans'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'hclust'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'randomForest'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'coxph'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'numeric'
mellio_payload(x, name = NULL, ..., .call = NULL)

## S3 method for class 'summaryDefault'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'fa'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'principal'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'factanal'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'prcomp'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'effectsize_table'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'effectsize_difference'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'effectsize_anova'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'see_effectsize_table'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'FitDiff'
mellio_payload(x, what = NULL, ..., .call = NULL)

## S3 method for class 'geeglm'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'glmerMod'
mellio_payload(
  x,
  ...,
  .call = NULL,
  exponentiate = FALSE,
  conf.int = TRUE,
  conf.level = 0.95
)

## S3 method for class 'htest'
mellio_payload(x, .data = NULL, ..., .call = NULL, .env = parent.frame())

## S3 method for class 'johnson_neyman'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'sim_slopes'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'lavaan'
mellio_payload(
  x,
  focal = NULL,
  diagram_omit = NULL,
  standardized = TRUE,
  ...,
  .call = NULL
)

## S3 method for class 'lm'
mellio_payload(x, focal = NULL, controls = NULL, ..., .call = NULL)

## S3 method for class 'lmerMod'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'manova'
mellio_payload(
  x,
  tests = c("Pillai", "Wilks", "Hotelling-Lawley", "Roy"),
  ...,
  .call = NULL
)

## S3 method for class 'summary.manova'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'mediate'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'summary.mediate'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'multinom'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'polr'
mellio_payload(x, ..., .call = NULL, conf.int = TRUE, conf.level = 0.95)

## S3 method for class 'clm'
mellio_payload(x, ..., .call = NULL, conf.int = TRUE, conf.level = 0.95)

## S3 method for class 'TukeyHSD'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'pairwise.htest'
mellio_payload(x, ..., .call = NULL, .env = parent.frame())

## S3 method for class 'dunn_test'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'wilcox_test'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 't_test'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'dunnTest'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'dunn.test'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'emmGrid'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'emm_list'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'glht'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'summary.glht'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'medSummary'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'medSummary2'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'modmedSummary'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'modmedSummary2'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'alpha'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'corr.test'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'character'
mellio_payload(x, title = NULL, ..., .call = NULL)

## S3 method for class 'data.frame'
mellio_payload(x, title = NULL, ..., .call = NULL)

## S3 method for class 'survfit'
mellio_payload(x, ..., .call = NULL, .env = parent.frame())

## S3 method for class 'Arima'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'forecast_ARIMA'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'ARIMA'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'ets'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'forecast'
mellio_payload(x, ..., .call = NULL)

mellio_payload(x, ...)

## S3 method for class 'mellio_payload'
mellio_payload(x, ..., .call = NULL)

## Default S3 method:
mellio_payload(x, ..., .call = NULL)

## S3 method for class ''NULL''
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'table'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'matrix'
mellio_payload(x, ..., .call = NULL)

## S3 method for class 'melliotab'
mellio_payload(x, ..., .call = NULL)

Arguments

x

A supported R object.

focal

Optional character vector of model terms to mark as the focal predictor(s). Recognised by lm/aov/anova methods.

controls

Optional character vector of model terms to mark as controls (vs focal predictors) — recognised by lm/aov/anova methods.

...

Additional arguments passed to the dispatched method.

.call

Internal — captured user call, used to attribute provenance to the calling script rather than this dispatch.

.env

Optional environment used when recovering source variables for supported test objects.

exponentiate

Logical. For GLM-style models, exponentiate coefficient estimates (for example, odds ratios in logistic models).

conf.int

Logical. Include coefficient confidence intervals when supported by the broom method.

conf.level

Confidence level for coefficient intervals.

name

Optional name to attach to the payload (used by the numeric/vector descriptive method).

what

Optional FitDiff table to extract: "comparison", "fit", or "diff". Defaults to the first available table.

.data

Optional data.frame to enrich supported htest results with observed descriptives, effect sizes, and figure data. When omitted, Mellio tries to recover simple source variables from the calling environment before falling back to test-only output.

diagram_omit

Optional character vector of parameter keys or variable names to omit from the generated SEM path diagram while retaining them in diagram metadata. Use exact path keys like "y ~ ideology" or a variable name like "ideology" for hidden covariate-style paths.

standardized

Include standardized estimates and standardized-solution metadata when available.

tests

Multivariate test statistics to extract (manova method). Defaults to all four classical tests.

title

Optional title override (psych/character/data.frame methods).

Details

Supported in v0: objects of class htest (t.test, cor.test, wilcox.test, chisq.test, fisher.test).

Schema: see docs/STATS-R-BRIDGE-SCHEMA.md in the repo. The payload is value-only: numeric statistics, p-values, and CIs go through unformatted; the Mellio web app applies citation-style rules (decimals, italics, leading zeros).

Value

A list with class mellio_payload, structured according to the v0.1 schema.

See Also

mellio_open() to open the result in Mellio. mellio_to_json() to serialise the payload offline.

Other R bridge: mellio_addin_send(), mellio_capture(), mellio_compare(), mellio_open(), mellio_to_json(), print.mellio_payload()

Examples

tt <- t.test(extra ~ group, data = sleep)
p <- mellio_payload(tt)
p$type
p$fields$statistic

mellio documentation built on Aug. 30, 2026, 1:06 a.m.