Skip to content
Back to formatted view

Raw Message

Message-ID: <3B4302DD.1C8DED50@inrialpes.fr>
Date: 2001-07-04T11:49:50Z
From: Olivier MARTIN
Subject: a little probleme

Hi all,

i would like to find the best way to resolve the following problem.
Suppoose i have a vector x of length N with k different elements.
length(x)=N
u<-unique(x)
length(u)=k

I would like to get a matrix M with k rows and N columns such that:
in each line i (i=1,...,k), which(x%in%u[i]) is equal to 1 and 0 else.

Thanks for your help.
Olivier


--
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at inrialpes.fr
38334 Saint Ismier cedex
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010704/e33482d5/attachment.html