| Title: | Dataset-Assembly Bridge for the nirs4all Ecosystem |
|---|---|
| Description: | R binding over the nirs4all-io C ABI (n4io_*): normalize inputs into a canonical DatasetSpec, infer a DatasetPlan, and validate a DatasetSpec. The JSON surface crosses the stable C ABI; the low-level 'n4io_*' functions take and return canonical JSON strings, while the idiomatic 'nio_*' layer accepts native R inputs (a path, a vector of files, or a config list) and returns typed S3 objects with print and as.data.frame methods. |
| Authors: | Gregory Beurier [aut, cre] |
| Maintainer: | Gregory Beurier <[email protected]> |
| License: | CeCILL-2.1 | AGPL-3 |
| Version: | 0.1.1 |
| Built: | 2026-06-12 11:44:50 UTC |
| Source: | https://github.com/GBeurier/nirs4all-io |
One row per scored decision (structure, signal type, task type, ...), with the
chosen value, the confidence score, whether it is
ambiguous, and the count of alternatives.
## S3 method for class 'n4io_plan' as.data.frame(x, ...)## S3 method for class 'n4io_plan' as.data.frame(x, ...)
x |
An |
... |
Ignored. |
A data.frame with columns decision, value,
score, ambiguous, n_alternatives.
The C ABI version string.
n4io_abi_version()n4io_abi_version()
Inspect a data input and return the scored DatasetPlan (JSON string).
n4io_infer(input_json, conventions_json = NULL)n4io_infer(input_json, conventions_json = NULL)
input_json |
A JSON path string or file-list array. |
conventions_json |
Optional JSON array of convention names, or NULL. |
The DatasetPlan as a JSON string.
Normalize an input into a canonical DatasetSpec (JSON string).
n4io_to_spec(input_json, conventions_json = NULL)n4io_to_spec(input_json, conventions_json = NULL)
input_json |
A JSON value: a spec object, a path string (e.g.
|
conventions_json |
Optional JSON array of convention names, or NULL. |
The canonical DatasetSpec as a JSON string.
Validate a DatasetSpec JSON string; raises an error if invalid.
n4io_validate(spec_json)n4io_validate(spec_json)
spec_json |
A DatasetSpec as a JSON string. |
Invisibly NULL on success.
Native-R wrapper over [n4io_infer()]: input is JSON-encoded internally
(with jsonlite) and the scored DatasetPlan is parsed back into a typed
n4io_plan object.
nio_infer(input, conventions = NULL)nio_infer(input, conventions = NULL)
input |
A path (character scalar), a vector of files (character vector),
or a config |
conventions |
Optional character vector of convention names, or
|
An object of class n4io_plan: the parsed plan (recommendations,
scored decisions, resolved_spec, overall_score). Use
as.data.frame.n4io_plan for the scored decisions as a
data.frame and nio_resolved_spec for the editable spec.
[n4io_infer()] for the raw JSON surface.
## Not run: plan <- nio_infer("/data/run") print(plan) as.data.frame(plan) # one row per scored decision spec <- nio_resolved_spec(plan) ## End(Not run)## Not run: plan <- nio_infer("/data/run") print(plan) as.data.frame(plan) # one row per scored decision spec <- nio_resolved_spec(plan) ## End(Not run)
The resolved (editable) DatasetSpec carried inside a plan.
nio_resolved_spec(plan)nio_resolved_spec(plan)
plan |
An |
An n4io_spec object built from plan$resolved_spec.
Native-R wrapper over [n4io_to_spec()]: input is JSON-encoded
internally and the canonical DatasetSpec is parsed back into a typed
n4io_spec object that round-trips byte-for-byte across the ABI.
nio_to_spec(input, conventions = NULL)nio_to_spec(input, conventions = NULL)
input |
A path (character scalar), a vector of files (character vector),
or a config |
conventions |
Optional character vector of convention names, or
|
An object of class n4io_spec: the parsed canonical spec. Pass
it directly to [nio_validate()] or [nio_infer()].
[n4io_to_spec()] for the raw JSON surface.
## Not run: spec <- nio_to_spec("/data/run") print(spec) nio_validate(spec) ## End(Not run)## Not run: spec <- nio_to_spec("/data/run") print(spec) nio_validate(spec) ## End(Not run)
Native-R wrapper over [n4io_validate()] that accepts an n4io_spec, a
plain list, or a JSON string. Returns invisibly TRUE on success
and signals an informative error otherwise.
nio_validate(spec)nio_validate(spec)
spec |
An |
Invisibly TRUE on success; otherwise an error is signalled.
[n4io_validate()] for the raw JSON surface.
## Not run: spec <- nio_to_spec("/data/run") nio_validate(spec) ## End(Not run)## Not run: spec <- nio_to_spec("/data/run") nio_validate(spec) ## End(Not run)