s-news
[Top] [All Lists]

Vector of same values

To: "Snews (E-mail)" <s-news@lists.biostat.wustl.edu>
Subject: Vector of same values
From: "Padma Illindra" <pillindra@quantros.com>
Date: Wed, 30 Oct 2002 12:39:53 -0800
Importance: Normal
Hi all,

Can you please help me with this?


I have a vector of values.  I am trying to return 'TRUE' if all the elements
of the vector are same. Otherwise it should return "FALSE".

For example:

x <- c(10,10,10,10,10)
should return "TRUE"

y <- c(10,20,5,10,10)
should return "FALSE".

Is there any command in s-plus that I can use to find out this.
I am trying to use which(x) and match command, but I couldn't work around
with those functions to accomplish this.


Thanks in advance for the help.

Padma







<Prev in Thread] Current Thread [Next in Thread>