Check if all values in a vector are the same

Description

This function is used to check if all values in a vector are equal. It can be used for example to check if a time series contains only 0 or NA values.

Usage

1
AllEqual(x)

Arguments

x

numeric, character vector, or time series of type ts

Value

The function returns TRUE if all values are equal and FALSE if it contains different values.

Author(s)

Matthias Forkel <matthias.forkel@geo.tuwien.ac.at> [aut, cre]

Examples

1
2
3
4
5
# check if all values are equal in the following vectors:
AllEqual(1:10)
AllEqual(rep(0, 10))
AllEqual(letters)
AllEqual(rep(NA, 10))