Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.61.0508150739170.19359@gannet.stats>
Date: 2005-08-15T06:42:59Z
From: Brian Ripley
Subject: Vector comparison to matrix
In-Reply-To: <BAY18-F9E3F0B10E871F7FFD6674D4B10@phx.gbl>

Probably you use the idea from unique.matrix, that is

1) form a string from each row and
2) call match() to see which strings match your pattern row.

On Sun, 14 Aug 2005, Todd Remund wrote:

> I am looking for a fast way to count the number of rows in a matrix are
> identical to a pattern vector.  For example, if I am interested in counting
> the number of row vectors in a matrix that are identical to (1,2,3) what
> would I do?  I have tried the identical statement in a loop but this is far
> too slow.  I have a very large matrix and need to avoid loops at all costs.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595