compare_vectors function

Compare Vectors

Compare Vectors

Compare numeric or logical vectors.

compare_vectors(..., sep = "", diff.char = "|")

Arguments

  • ...: vectors of the same length
  • sep: a string
  • diff.char: a single character

Details

The function compares vectors with one another. The main purpose is to print a useful representation of differences (and return differences, usually invisibly).

The function is still experimental and will likely change.

Returns

depends on how the function is called; typically a list

Author(s)

Enrico Schumann

See Also

neighbourfun

Examples

x <- runif(5) > 0.5 nb <- neighbourfun(type = "logical") compare_vectors(x, nb(x)) ## 01010 ## | ## 00010 ## The vectors differ in 1 place. nb <- neighbourfun(type = "logical", stepsize = 2) compare_vectors(x, nb(x)) ## 01010 ## | | ## 11011 ## The vectors differ in 2 places.