Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.4.10.10202250936320.1628-100000@fisher.stat.ucla.edu>
Date: 2002-02-25T17:39:18Z
From: Roger D. Peng
Subject: another basic ?
In-Reply-To: <4.3.2.7.2.20020225120152.00a9d100@pop.service.ohio-state.edu>

On Mon, 25 Feb 2002, jimi adams wrote:

> i am sure that there is a simple solution that i am just overlooking, but 
> there is no logical test for =
> there is one for != and >,<, >=, <=...
> what do i do if i need to check if something IS EQUAL

Depends.  To test if two objects are the same, you can use identical().
Or you might use == in other situations.  It's hard to know without more
details.

> or is there an easy way, in working with a matrix of size n x 3,  to sort 
> the matrix by one of the columns?

If m is an n x 3 matrix, to sort by column 1, you could do:

> m.sorted <- m[order(m[,1]), ]

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng

> 
> 
> specifically what i am trying to do is i have a matrix with individual and 
> group labels that is randomly generated, and is by default sorted by the 
> individual labels ( column 1) and i want them to be organized into unique 
> group labels (comlumn 2)
> thanks
> jimi
> jimi adams
> Department of Sociology
> The Ohio State University
> 300 Bricker Hall
> 190 N. Oval Mall
> Columbus, OH 43210-1353
> 614-688-4261
> 
> our mind has a remarkable ability to think of contents as being independent 
> of the act of thinking
>                                              -georg simmel
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._