Skip to contents

Export a compact JSON payload containing per-respondent posterior means for public and private probabilities. The payload also includes model metadata fields (statement, experiment) and predictor names. When metadata are unavailable, corresponding fields are exported as JSON null. Internally this applies lx_prune(compress = "mean").

Usage

lx_export(model, path = NULL, pretty = TRUE)

Arguments

model

An object of class lx_model.

path

Optional file path. If NULL, returns a JSON string.

pretty

Logical. If TRUE, pretty-print the JSON.

Value

If path is NULL, a JSON string. Otherwise, returns path invisibly after writing. The JSON payload includes fields statement, experiment, predictors, public, and private.

Examples

json_txt <- lx_export(example_lx_model)
# lx_export(example_lx_model, "model_means.json")