Comparing elements of a vector

Question:

People I need a function that checks that all the coordinates of the vector are equal.

a = rep(1, 5)

Let the previous output be TRUE.

b = c(rep(1, 4),2)

Let the previous output be FALSE.

Answer:

I understood,

all(a[1] == a)

e

all(b[1] == b)
Scroll to Top