flatteningJustifierElements: Flatten a justifier tree

flattenR Documentation

Flatten a justifier tree

Description

Flattening takes all justifications, assertions, and sources from their parents and returns a structured justifier object containing these elements in separate lists, with each occurrence replaced with a reference to the corresponding identifier.

Usage

flatten(x, ..., recursionLevel = 0, silent = justifier::opts$get("silent"))

## S3 method for class 'multipleJustifierElements'
flatten(x, ..., recursionLevel = 0, silent = justifier::opts$get("silent"))

## S3 method for class 'singleJustifierElement'
flatten(x, ..., recursionLevel = 0, silent = justifier::opts$get("silent"))

Arguments

x

The justifier object or objects.

...

Additional arguments are passed to the methods.

recursionLevel

The depth of the recursion

silent

Whether to be silent or chatty

Value

A flattened justifier object.

Examples

### Programmatically create a justification with two assertions
### but without sources
justifierJustification <-
  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
  );

### Flatten it into a structures justifier object
structuredJustification <-
  justifier::flatten(
    justifierJustification
  );

### Check it
str(structuredJustification, 1);

justifier documentation built on March 7, 2023, 6:59 p.m.