s-news
[Top] [All Lists]

Re: Vector of same values

To: pillindra@quantros.com, s-news@lists.biostat.wustl.edu
Subject: Re: Vector of same values
From: Ray Brownrigg <ray@mcs.vuw.ac.nz>
Date: Thu, 31 Oct 2002 09:57:30 +1300 (NZDT)
> 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.
> 
Try:
all(x==x[1])

Hope this helps,
Ray Brownrigg <ray@mcs.vuw.ac.nz>       http://www.mcs.vuw.ac.nz/~ray

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