Compare vocabularies with set operations

compare_convo(vocab1, vocab2, fx = c("setdiff", "intersect", "union"))

Arguments

vocab1

Vocabulary list (or convo object). In the case of validating a new vocabulary against an existing one, this argument should take the new vocabulary.

vocab2

Vocabulary list (or convo object). In the case of validating a new vocabulary against an existing one, this argument should take the existing vocabulary.

fx

Character string describing comparison function. setdiff returns those in vocab1 not in vocab2; intersect returns those in both vocab1 and vocab2; union returns all elements in either

Value

List (of class convomin) of mismatches

Examples

v1 <- list(letters[1:3], letters[4:6], letters[7:9]) v2 <- list(letters[(1:3)+1], letters[(4:6)-2], letters[7]) compare_convo(v1, v2, "setdiff")
#> Level 1 #> - a #> Level 2 #> - e #> - f #> Level 3 #> - h #> - i
compare_convo(v1, v2, "union")
#> Level 1 #> - b #> - a #> - c #> - d #> Level 2 #> - b #> - d #> - e #> - f #> - c #> Level 3 #> - g #> - h #> - i
compare_convo(v1, v2, "intersect")
#> Level 1 #> - b #> - c #> Level 2 #> - d #> Level 3 #> - g