R: Test whether all elements of a vector are equal

allEqual {tractor.base} | R Documentation

## Test whether all elements of a vector are equal

### Description

This function is a wrapper around `all`, testing whether all elements of the specified vector are equal to each other.

### Usage

    allEqual(x, ignoreMissing = FALSE)

### Arguments

`x` | A vector of any mode, including a list.
`ignoreMissing` | If `TRUE`, missing elements will be ignored. Otherwise the presence of missing values will result in a return value of `FALSE`.

### Value

`TRUE` if all elements test (exactly) equal; `FALSE` otherwise.

### Author(s)

Jon Clayden

### References

Please cite the following reference when using TractoR in your work:

J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18. http://www.jstatsoft.org/v44/i08/.

### See Also

`equivalent` for elementwise equivalence of two vectors.

### Examples

    allEqual(c(1,1,1))  # TRUE
    allEqual(c(1,1,NA))  # FALSE
    allEqual(c(1,1,NA), ignoreMissing=TRUE)  # TRUE

[Package tractor.base version 3.2.2 Index]