Learn R Programming

justifier (version 0.2.6)

import_from_json: Import a structured justifier object from JSON

Description

Import a structured justifier object from JSON

Usage

import_from_json(x)

Value

The justifier object.

Arguments

x

Either a path to an existing file, or a character vector with the JSON to import.

Examples

Run this code
### Programmatically create a justification with two assertions
### but without sources; flatten it; and show the json
justifier::justify(
  "Icecream will make me feel less fit",
  assertion = c(
    justifier::assert('Icecream is rich in energy'),
    justifier::assert('Consuming high-energy foods makes me feel less fit')
  ),
  weight = -.5
) |>
  justifier::flatten() -> originalObject;

originalObject |>
  justifier::export_to_json() ->
  exportedJSON;

### And import it again
importedFromJSON <-
  justifier::import_from_json(
    exportedJSON
  );

Run the code above in your browser using DataLab