<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi all,
<p>i would like to find the best way to resolve the following problem.
<br>Suppoose i have a vector x of length N with k different elements.
<br>length(x)=N
<br>u<-unique(x)
<br>length(u)=k
<p>I would like to get a matrix M with k rows and N columns such that:
<br>in each line i (i=1,...,k), which(x%in%u[i]) is equal to 1 and 0 else.
<p>Thanks for your help.
<br>Olivier
<br>
<pre>--
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
Olivier MARTIN phone: (33) 04 76 61 53 55
Projet IS2 06 08 67 93 42
INRIA Rhone-Alpes fax : (33) 04 76 61 54 77
655, Av. de l'Europe
Montbonnot e-mail:olivier.martin@inrialpes.fr
38334 Saint Ismier cedex
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-</pre>
</html>