accumulate_pred_trans: Run predicates transitively

Description Usage Arguments Details Value Related Functions and Methods See Also

View source: R/helpers.R

Description

Assumes that if a predicate on the left is FALSE, the succeeding one on the right will also be FALSE and can thus be skipped.

Usage

1
2
3

Arguments

.z

A list or atomic vector.

.lf

A list of predicate functions.

...

Additional named arguments to .lf.

.p

A predicate function.

Details

When checking data (such as bibliometric metadata) against several criteria of compliance (such as uniqueness, syntax), two conditions can hold:

  1. The criteria is an aggregate phenomenon, such as in the case of uniqueness. It does not make sense to ask if any individual data element is unique, but the entire data vector must be unique. Happily, this condition is "downward compatible": If the criteria is an individual phenomenon (such as syntax), it can also tested in vectorised form against the entire vector.

  2. The criteria may be in some transitive order. For example, if a value is.integer() it will also be is.numeric(); an integer is a special case of a numeric value. Typically, these criteria may be listed in decreasing order of generality: You'd first test if something is is.numeric() and then whether it's also is.integer(). Formally, this means that predicate functions may be given in negative transitive order, where .lfn == FALSEimplies.lfn+1 == FALSE'.

    Abstracting away these ordered predicates with functional programming brings significant benefits:

    1. It saves computation. If .lf[n+1](.z) is already known to be FALSE, it need not be run.

    2. It helps improve expressiveness and reduces complexity of the predicates.

Value

A dataframe of logical vectors, one column per predicate function. Skipped predicate tests return a NA.

Related Functions and Methods

Functions

See Also

Other helpers: auth_cr(), auth_mailjet(), deployAppSaio()


subugoe/hybridmdpackage documentation built on Jan. 25, 2022, 9:51 p.m.