--- spec: openflange.org/pipe/v0.1 id: r-summary version: 0.1.0 title: R summary description: Count, mean, median and standard deviation of the `value` member, computed by an ordinary R script. license: Apache-2.0 keywords: [r, statistics, summary, mean, median, example] maturity: experimental scope: dataset deterministic: true inputs: records: description: 'Records with a numeric `value` member, e.g. {"value": 10}.' schema: format: json-schema definition: {type: object} outputs: summary: description: 'Exactly one record: {"count", "mean", "median", "sd"} (+ "skipped" with onInvalid=skip). Statistics that do not exist are null.' schema: format: json-schema definition: type: object required: [count, mean, median, sd] properties: count: {type: integer, minimum: 0} mean: {type: [number, "null"]} median: {type: [number, "null"]} sd: {type: [number, "null"]} skipped: {type: integer, minimum: 0} parameters: onInvalid: type: string enum: [fail, skip] default: fail description: What to do with a record whose `value` is missing, null or not a number. `fail` stops the run; `skip` leaves it out and counts it in `skipped`. implementation: type: script language: r path: summary.R permissions: subprocess: true --- # R summary Implements the [OpenFlange](https://openflange.org/) specification. `summary.R` is a plain R script: NDJSON on stdin, one NDJSON record on stdout. This manifest only *describes* it — the script runs unchanged with or without a runner. See [README.md](README.md) for input → command → output. - **Dataset scope**: the script reads all of its input before answering, so memory grows with the input. For a bounded, streaming alternative see `../r-moving-window`. - **Empty input** is valid: `{"count":0,"mean":null,"median":null,"sd":null}`. - **One value** has no standard deviation: `sd` is `null`. - **Missing, null or non-numeric `value`**: the run fails and names the record (`onInvalid: fail`, the default), or the record is left out and counted in `skipped` (`onInvalid: skip`). It is never dropped silently. - **Permissions**: `subprocess` (it starts `Rscript --vanilla`). No network, no files. A subprocess is not a sandbox.