compare_vectors {neighbours}R Documentation

Compare Vectors

Description

Compare numeric or logical vectors.

Usage

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.

Value

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.

[Package neighbours version 0.1-3 Index]