Learn R Programming

diyar (version 0.4.0)

sub_criteria: Sub-criteria

Description

Additional matching criteria for each iteration of links and episodes.

Usage

sub_criteria(
  ...,
  match_funcs = diyar::exact_match,
  equal_funcs = diyar::exact_match,
  operator = "or"
)

attrs(..., .obj = NULL)

Arguments

...

[atomic]. Attributes.

match_funcs

[function]. User defined logical test for matches.

equal_funcs

[function]. User defined logical test for identical record sets (all attributes of the same record).

operator

[character]. Options are "and" or "or".

.obj

[data.frame|list]. Attributes

Value

sub_criteria

Details

sub_criteria() - The mechanism for providing matching criteria to an iteration of links or episodes. It creates a sub_criteria class object which contains the attributes to be compared, logical tests for the comparisons (see predefined_tests for examples) and another set of logical tests to determine identical records.

attrs() - Pass a collection of attributes to each ... in sub_criteria().

Every attribute, including those in a collection, must have the same length or a length of 1.

See Also

predefined_tests; links; episodes; eval_sub_criteria

Examples

Run this code
# NOT RUN {
# Sub-criteria
s_cri1 <- sub_criteria(c(30, 28, 40, 25, 25, 29, 27),
                       match_funcs = range_match)
s_cri2 <- sub_criteria(c(30, 28, 40, 25, 25, 29, 27),
                       match_funcs = exact_match)

# Nested sub-criteria
s_cri3 <- sub_criteria(s_cri1, s_cri2, operator = "or")
s_cri4 <- sub_criteria(s_cri1, s_cri3, operator = "and")

# Objects of the same length
attrs(month.abb, month.name)

# Or a data.frame or list with elements of the same length
attrs(.obj = mtcars)

# Or a combinaiton of the both
attrs(mtcars$mpg, mtcars$cyl, .obj = mtcars)

# Each can then be passed to a `sub-criteria`
sub_criteria(
month.abb,
month.name,
attrs(month.abb, month.name)
)

# }

Run the code above in your browser using DataLab